Skip to content

Commit

Permalink
Merge pull request #5 from fivetran/feature/contact-id
Browse files Browse the repository at this point in the history
Add Contact IDs to General Ledger
  • Loading branch information
kristin-bagnall authored May 25, 2021
2 parents 3845f3f + 9085f83 commit ce71bb3
Show file tree
Hide file tree
Showing 11 changed files with 309 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ vars:
invoice_line_item: "{{ source('xero','invoice_line_item') }}"
contact: "{{ source('xero','contact') }}"
organization: "{{ source('xero','organization') }}"
bank_transaction: "{{ source('xero','bank_transaction') }}"
credit_note: "{{ source('xero','credit_note') }}"

models:
xero_source:
+materialized: table
+schema: stg_xero
tmp:
+materialized: view
+materialized: view
156 changes: 156 additions & 0 deletions integration_tests/data/xero_bank_transaction_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
bank_transaction_id,contact_id
8786743e-197f-4865-935e-5ef5bfe17ea2,
bcc7bea7-8081-498e-a7c7-5f94daaef3ec,
449015d8-6e43-43e8-8492-2f54c5caacff,
02d65e1e-df27-4622-9ebe-5f07644d3e05,
2be0cc75-6561-4235-9535-08f647d047bf,
34138515-ceb3-4111-bfd8-0fd04790a915,
bf6ea4f1-4b87-46ab-aae2-4e1a6b926bf0,
97519ea1-d0d6-44a1-9466-16492cb4619e,
ea833987-b099-4c2e-8118-033ffbc63101,
2e71cb87-8fa8-4661-8060-dee367f4cf86,
6ec05358-4a3a-4e15-b00f-e9afea1069c5,
e87cc6fb-5d8b-4706-a22a-782d7190b872,
af9601f0-80b2-40a5-a169-cc2d53da761d,
d25beabd-8a7a-4dbe-b99d-4b71cdad575a,
67e7a2d6-b7c5-49c9-b434-c06ea6ce6f34,
6f1a557a-0553-42d8-b075-218725343a55,
16dbbdb3-a249-456e-9aef-36f8ef8d9ea0,e64c7082-7d6e-4169-b027-3785aa3a34b9
c952f937-1f8b-483e-9e3a-36b2581a6810,0ba3460a-2a40-4e76-b0e4-ceb125016f63
52190c1e-8b13-4ce8-9b8a-e0914b706097,72230621-a99b-49a1-aed6-d30a1c6ce0db
986e7022-9699-4ddd-8c35-ace81dc50e7c,72230621-a99b-49a1-aed6-d30a1c6ce0db
860b1ad6-4289-4c48-b5cd-55b17fe37f18,5bb69734-b6b6-442b-95c0-fedeb6aebac5
119dea7b-e229-40c4-9cd1-30e530d6e7f2,5bb69734-b6b6-442b-95c0-fedeb6aebac5
436ca747-9244-4e67-b337-ef3c1d9926b5,ae5908b8-268b-41ac-9d31-394672b2ead6
c3d432f8-7dce-4244-b52e-bc2ddf011c29,ae5908b8-268b-41ac-9d31-394672b2ead6
e9986969-bb44-482b-a5b4-73827f1ee7b2,ae5908b8-268b-41ac-9d31-394672b2ead6
a83b86c7-3bae-4132-a9e4-b73d82a42c4b,c6530936-5159-42b1-a327-6cf624d05cb0
57ab84ad-c269-400c-9ff1-01fb15c07071,ae5908b8-268b-41ac-9d31-394672b2ead6
b090d48b-b787-4b59-90bf-77414f058d6a,ae5908b8-268b-41ac-9d31-394672b2ead6
7c8793ad-029d-47ef-8fa9-6bafae796adc,ae5908b8-268b-41ac-9d31-394672b2ead6
a34ac60c-dbc4-4e04-9e68-dad634e44356,ae5908b8-268b-41ac-9d31-394672b2ead6
3fa6b857-9180-4ccb-94c9-12216dba4d3f,ae5908b8-268b-41ac-9d31-394672b2ead6
e5206123-4dde-4086-99e6-d9b8269cbd57,ae5908b8-268b-41ac-9d31-394672b2ead6
5d1e9267-4758-41d8-b673-ea5ba720256e,ae5908b8-268b-41ac-9d31-394672b2ead6
ac157911-a6e7-4a4f-a93f-079a2b01f50b,ae5908b8-268b-41ac-9d31-394672b2ead6
30b52e4b-5a31-4b1f-9a3c-d49d7bd2afad,ae5908b8-268b-41ac-9d31-394672b2ead6
12cfe2be-afe5-4131-b9d9-94d6c89dd305,ae5908b8-268b-41ac-9d31-394672b2ead6
5432db39-a502-4b2e-80e2-bbb2a5fc2d0e,ae5908b8-268b-41ac-9d31-394672b2ead6
0f912970-2e4a-499e-a87c-95b2376ba693,ae5908b8-268b-41ac-9d31-394672b2ead6
5ffec6fd-b22b-4466-abbf-4a024d06c265,5bb69734-b6b6-442b-95c0-fedeb6aebac5
966014ae-6a15-414d-8c08-25e9757c7ce1,d30fec4c-f86f-484b-a654-4420c6a75fce
b644e33b-d835-4c67-a1d7-969a948e4e9d,577d32fe-1e0d-4def-954c-4578784e71e4
bc74841e-eaac-4520-89a7-33e81c7cae3a,e1b69cf3-69ed-4b1e-81f3-d146573959cf
6fc51ac8-df19-4452-8c2b-42c9243984a4,72230621-a99b-49a1-aed6-d30a1c6ce0db
5d037975-100b-43f4-808c-f3d2fd821fe3,72230621-a99b-49a1-aed6-d30a1c6ce0db
6a356d3c-34a2-4b1f-8982-f7c56ff8d1ec,72230621-a99b-49a1-aed6-d30a1c6ce0db
503e5ef4-c178-4e21-936c-4e8148135605,72230621-a99b-49a1-aed6-d30a1c6ce0db
a84ba690-1d37-4c6d-aef9-e9d0314654f0,72230621-a99b-49a1-aed6-d30a1c6ce0db
57c5ca13-2fcc-46a6-99a3-a00d895813bc,5bb69734-b6b6-442b-95c0-fedeb6aebac5
f9c92498-9a84-4ace-b036-6e6543edc2f0,3bbc0733-d765-40a0-86f3-8cd295d7b412
dc034ad6-8a7b-401d-95a0-645193547a90,5bb69734-b6b6-442b-95c0-fedeb6aebac5
7fa00522-4979-4e3a-9c62-565b34249dd4,5bb69734-b6b6-442b-95c0-fedeb6aebac5
c749eef2-d54a-4acf-be5d-b9626c340c5b,5bb69734-b6b6-442b-95c0-fedeb6aebac5
5d74b9b9-13bc-4380-9608-981b2f949617,a28ef3cc-ed10-403d-a3dc-b0c8ad3ff9af
43097501-0e03-464e-9a46-f171ee7bfee5,20f6e8ee-ce44-433e-ab23-020ecc0ddf21
14fbfb44-76f7-4b8f-bb39-02a9e879ce9d,
50ae9e17-e36f-4c1f-b831-2393f3a31989,
4cfe663f-da18-47f8-ab4b-f592a024b45e,
85339fa0-da97-49ae-bcbf-ee28b40cafe8,
678e270c-11f6-4ea5-bdf5-612c82e12a5e,
ea84b6f7-5b3a-419f-9f95-7c14cae04a26,
968ac848-a817-478c-bae3-f486601032d5,
9ce07292-d289-4b1f-8a0f-25083873e651,
572e398f-3ae0-4dee-af71-9db6c5eadb78,
ef5b6c6a-13b9-449a-9384-fc438ddf9480,
6743dbbf-a2e3-4f1e-8275-82a690b9441a,
31919c5e-dccf-466e-91dd-edc7ce5e7b1f,
84d0f6e0-f913-42e9-8da6-8270c87f5f0f,
b0c45698-b59e-4ff4-b733-a3bb0e660ed5,
bc74410b-6f88-45e4-b295-c9a4c588f23a,
cfed01ce-1d7c-4b1e-9a08-9d1b58e3463a,
e13808c0-aa91-4168-8895-e35e740bfeb7,0bde901d-f35d-4d73-a0e1-345b7e118e2e
3c0b8d53-cc61-4f78-8819-d52f60aec1f7,0bde901d-f35d-4d73-a0e1-345b7e118e2e
a3cd5b1b-be5b-4d99-9f44-a1c1767e41c5,0bde901d-f35d-4d73-a0e1-345b7e118e2e
9bd7a985-6746-4bca-b278-14da5f2c5d1d,c7263356-d84e-4233-b789-4cbb0f4d5c3a
41278a1c-5969-4714-b2e4-223794da7761,c7263356-d84e-4233-b789-4cbb0f4d5c3a
592d053b-cf6b-4d21-af97-638c55502076,0bde901d-f35d-4d73-a0e1-345b7e118e2e
9c3c2331-9d64-4d70-9fcf-d6f1d3e7e3e0,0bde901d-f35d-4d73-a0e1-345b7e118e2e
b1e52d3d-eded-472a-b93a-d67a05183b39,0bde901d-f35d-4d73-a0e1-345b7e118e2e
3340b4f1-ce5a-499e-ab5f-8bb7d8cef024,0bde901d-f35d-4d73-a0e1-345b7e118e2e
4a163dc7-4a2a-4242-a12a-5d78c2ea53ad,0bde901d-f35d-4d73-a0e1-345b7e118e2e
6b54ebc2-3b30-4262-910f-be27a2cceaa3,0bde901d-f35d-4d73-a0e1-345b7e118e2e
ad3419c9-738b-496d-8876-99235c212271,0bde901d-f35d-4d73-a0e1-345b7e118e2e
da1a6616-89f7-4a35-b8c9-ae2f5b02dc40,a23e354f-b5b7-4de2-a44b-72263f16691f
0c7c7109-9f89-4dbf-8c32-dba76a3972bc,3bbc0733-d765-40a0-86f3-8cd295d7b412
d5a4611b-e4ad-45fe-839e-0fda9b132366,b491aab8-c737-4a7f-bc3f-53d8f79ce58b
a61b223b-afc3-424b-9097-d59bacb2bd00,b491aab8-c737-4a7f-bc3f-53d8f79ce58b
fa767f71-4ae9-45c6-abf3-0525a0f40270,0bde901d-f35d-4d73-a0e1-345b7e118e2e
3caea4af-dca7-4298-bbd2-024f7a4558cb,3bbc0733-d765-40a0-86f3-8cd295d7b412
f58bb48e-da9f-4646-ac76-4857c81fa910,3bbc0733-d765-40a0-86f3-8cd295d7b412
e5e41ce6-51c4-4de5-8742-19f26d2553da,98834681-ec6b-457d-af02-1b6709fb5052
228343f5-bbae-40b1-a736-566cf0d280ad,0bde901d-f35d-4d73-a0e1-345b7e118e2e
2ba509e0-877e-4d6c-b6cd-2937cc31d94e,538e2bfe-de22-44ed-bffa-f685a7866924
a08d2f54-1d82-4eda-8cf2-0fa4719cdc27,538e2bfe-de22-44ed-bffa-f685a7866924
a5c4fda3-426f-4714-b4a2-93e3c7d0749d,0bde901d-f35d-4d73-a0e1-345b7e118e2e
a791b019-c295-454b-9efa-cef5448a538f,3bbc0733-d765-40a0-86f3-8cd295d7b412
1bb20010-94d1-4c75-b9a1-eb1cecf17e20,3bbc0733-d765-40a0-86f3-8cd295d7b412
b94c2719-ed61-41f0-9e8d-b860747b3f5d,3bbc0733-d765-40a0-86f3-8cd295d7b412
d7a5ff03-68b2-492c-affe-cbbd808a136d,3bbc0733-d765-40a0-86f3-8cd295d7b412
e70ab479-fc95-4683-a31b-e66302cf0f2a,3bbc0733-d765-40a0-86f3-8cd295d7b412
aee32456-c229-4c4b-9950-fe8a776ccabd,3bbc0733-d765-40a0-86f3-8cd295d7b412
9b2b4a71-ea52-4040-8450-5b2bb49dd6c8,538e2bfe-de22-44ed-bffa-f685a7866924
523031cd-3582-42a2-964b-cf2a271e8a62,4b2b1897-c454-48c5-a8a9-761520bdc7cd
89b268e4-cf44-45e9-b969-141b9ff57347,3bbc0733-d765-40a0-86f3-8cd295d7b412
3d3eb893-74fe-4b4f-b780-7f6ef9439ee9,3bbc0733-d765-40a0-86f3-8cd295d7b412
fa95b331-b1fe-4ed1-bb39-ca95824af103,fabc3c70-cb94-4759-be07-4e9116c8139a
477bfd81-d2b8-4dbc-8ee5-3b93ed74f464,3bbc0733-d765-40a0-86f3-8cd295d7b412
ee00b3dd-095f-475e-954e-5d3d08ded986,3bbc0733-d765-40a0-86f3-8cd295d7b412
0083cd41-8864-4244-bc57-fd3c4f25b239,3bbc0733-d765-40a0-86f3-8cd295d7b412
b812ec40-2bb8-48b4-9af6-fb28cbead45c,3bbc0733-d765-40a0-86f3-8cd295d7b412
ad109d1a-3534-4d9e-a0f9-48df348399ad,3bbc0733-d765-40a0-86f3-8cd295d7b412
268f3744-5057-4b5f-9c80-94b71f05dbb4,3bbc0733-d765-40a0-86f3-8cd295d7b412
d6107d20-e06e-4d93-8280-9cce5ea2b9aa,3bbc0733-d765-40a0-86f3-8cd295d7b412
10bbb330-c093-46e8-aab7-9c9077ad91cb,3bbc0733-d765-40a0-86f3-8cd295d7b412
fd1c25de-7b68-42fc-936a-384a813ea554,3bbc0733-d765-40a0-86f3-8cd295d7b412
33a42d61-e70b-46de-84ec-a138c4739e89,3bbc0733-d765-40a0-86f3-8cd295d7b412
77945f89-69ae-43e9-8544-0faa7bfbab13,3bbc0733-d765-40a0-86f3-8cd295d7b412
8bb2bd7c-9b66-4cf4-ac1c-b03645e471c2,3bbc0733-d765-40a0-86f3-8cd295d7b412
a78f3a6b-09fe-4f4f-99b7-0bf52281266e,3bbc0733-d765-40a0-86f3-8cd295d7b412
7ceff0fa-3776-4e61-871e-469534080664,3bbc0733-d765-40a0-86f3-8cd295d7b412
de073eab-32d8-428f-b4f7-7956e9ae1447,3bbc0733-d765-40a0-86f3-8cd295d7b412
588795b9-a9b3-4f04-abdf-c299260a0f35,3bbc0733-d765-40a0-86f3-8cd295d7b412
1ab06749-b0c9-4058-9a38-233a976fb276,3bbc0733-d765-40a0-86f3-8cd295d7b412
1cfd4522-8982-4e1c-b942-2ae77b2bc66a,3bbc0733-d765-40a0-86f3-8cd295d7b412
b794d8b3-e3ab-4e05-83d5-14a9d69e166d,3bbc0733-d765-40a0-86f3-8cd295d7b412
99e52b0d-6e01-4e8c-b50e-10a6334a3f6c,3bbc0733-d765-40a0-86f3-8cd295d7b412
f66826e9-0b74-45db-917c-1e2d8d3f1f9b,3bbc0733-d765-40a0-86f3-8cd295d7b412
51ad2d71-cc7e-4cad-b47f-d1997b51b775,3bbc0733-d765-40a0-86f3-8cd295d7b412
5439ba83-d7ce-4759-b741-18bf7c369831,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
45af26f5-8dc3-4a00-bbc6-cdd07fc3c165,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
1efa4104-469f-4b86-adb0-b1e5cecb2ddf,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
eefb5a88-8f56-4656-9504-0b3da8c35dca,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
af3adbda-b86f-41ae-ba3b-4fed38a08853,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
2a8167ea-c273-43f4-a9b0-1f1f21e6131c,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
2ee039c0-b2cc-40fb-b36c-bbccff97a694,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
ae837850-98c6-4177-84c4-52051dec17da,3bbc0733-d765-40a0-86f3-8cd295d7b412
111c025a-7248-4732-a94f-57b43e9bbb42,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
a084528f-8bed-44eb-984d-4555fcf68313,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
e76acdd0-a622-48cb-b658-3c2e827b21c6,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
2ee04a60-8748-4068-ab65-9233e4cb5660,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
a4ff9628-d512-46da-9915-e8349d53ef60,3bbc0733-d765-40a0-86f3-8cd295d7b412
1e490357-fdc0-4fd4-a4ae-b975bccfeb92,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
fad6c63a-3d0f-45e3-a30d-53cc91697ede,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
6e3ffc7c-0a2d-4d2b-be11-982eb40ca05b,3bbc0733-d765-40a0-86f3-8cd295d7b412
23059a2d-888b-45cd-95ae-0c92c5ddd879,3bbc0733-d765-40a0-86f3-8cd295d7b412
b0d854b4-b05c-47e1-8979-9b880745d810,3bbc0733-d765-40a0-86f3-8cd295d7b412
9e8ae2df-0363-4128-88b9-73be2a1d37ca,3bbc0733-d765-40a0-86f3-8cd295d7b412
2e4b5178-feb7-4bfa-9da9-ddf27e090af0,3bbc0733-d765-40a0-86f3-8cd295d7b412
c953e182-80d5-470a-bcac-1282331a957e,3bbc0733-d765-40a0-86f3-8cd295d7b412
fc55ab1f-ec6e-4b34-bf24-77127587e9bb,a23e354f-b5b7-4de2-a44b-72263f16691f
ef98bed8-b902-435e-9c34-324a6a2eb8d7,2e1f552c-8f80-4d36-8638-a7d377c9357a
df63bea1-6b14-4b6a-9dfc-2f47d9d313a2,a23e354f-b5b7-4de2-a44b-72263f16691f
9418cd19-5e56-443f-b12d-1cb5a98037eb,3bbc0733-d765-40a0-86f3-8cd295d7b412
51431251-feb7-4548-aa48-f898d63996bb,3bbc0733-d765-40a0-86f3-8cd295d7b412
7c658eec-c01e-482c-b36d-c5749030154e,3bbc0733-d765-40a0-86f3-8cd295d7b412
007a627c-a9a6-4bde-960f-05425e2202af,bd2cd9a0-ab55-4a97-b509-31deadb0d40f
3 changes: 3 additions & 0 deletions integration_tests/data/xero_credit_note_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
credit_note_id,contact_id
c9d2d3eb-c3af-4f79-9cb6-de9801176044,72230621-a99b-49a1-aed6-d30a1c6ce0db
d544840c-617f-4351-9981-741e30ac0299,fd5ed652-4f16-46b5-a185-a1bb3838bf20
4 changes: 3 additions & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ vars:
contact: "{{ ref('xero_contact_data') }}"
invoice: "{{ ref('xero_invoice_data') }}"
invoice_line_item: "{{ ref('xero_invoice_line_item_data') }}"
organization: "{{ ref('xero_organization_data') }}"
organization: "{{ ref('xero_organization_data') }}"
credit_note: "{{ ref('xero_credit_note_data') }}"
bank_transaction: "{{ ref('xero_bank_transaction_data') }}"
37 changes: 37 additions & 0 deletions macros/get_bank_transaction_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% macro get_bank_transaction_columns() %}

{% set columns = [
{"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()},
{"name": "bank_account_id", "datatype": dbt_utils.type_string()},
{"name": "bank_transaction_id", "datatype": dbt_utils.type_string()},
{"name": "batch_payment_batch_payment_id", "datatype": dbt_utils.type_string()},
{"name": "batch_payment_date", "datatype": dbt_utils.type_timestamp()},
{"name": "batch_payment_id", "datatype": dbt_utils.type_string()},
{"name": "batch_payment_is_reconciled", "datatype": "boolean"},
{"name": "batch_payment_status", "datatype": dbt_utils.type_string()},
{"name": "batch_payment_total_amount", "datatype": dbt_utils.type_float()},
{"name": "batch_payment_type", "datatype": dbt_utils.type_string()},
{"name": "batch_payment_updated_date_utc", "datatype": dbt_utils.type_timestamp()},
{"name": "contact_id", "datatype": dbt_utils.type_string()},
{"name": "currency_code", "datatype": dbt_utils.type_string()},
{"name": "currency_rate", "datatype": dbt_utils.type_numeric()},
{"name": "date", "datatype": "date"},
{"name": "external_link_provider_name", "datatype": dbt_utils.type_string()},
{"name": "has_attachments", "datatype": "boolean"},
{"name": "is_reconciled", "datatype": "boolean"},
{"name": "line_amount_types", "datatype": dbt_utils.type_string()},
{"name": "overpayment_id", "datatype": dbt_utils.type_string()},
{"name": "prepayment_id", "datatype": dbt_utils.type_string()},
{"name": "reference", "datatype": dbt_utils.type_string()},
{"name": "status", "datatype": dbt_utils.type_string()},
{"name": "sub_total", "datatype": dbt_utils.type_numeric()},
{"name": "total", "datatype": dbt_utils.type_numeric()},
{"name": "total_tax", "datatype": dbt_utils.type_numeric()},
{"name": "type", "datatype": dbt_utils.type_string()},
{"name": "updated_date_utc", "datatype": dbt_utils.type_timestamp()},
{"name": "url", "datatype": dbt_utils.type_string()}
] %}

{{ return(columns) }}

{% endmacro %}
30 changes: 30 additions & 0 deletions macros/get_credit_note_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% macro get_credit_note_columns() %}

{% set columns = [
{"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()},
{"name": "applied_amount", "datatype": dbt_utils.type_numeric()},
{"name": "branding_theme_id", "datatype": dbt_utils.type_string()},
{"name": "contact_id", "datatype": dbt_utils.type_string()},
{"name": "credit_note_id", "datatype": dbt_utils.type_string()},
{"name": "credit_note_number", "datatype": dbt_utils.type_string()},
{"name": "currency_code", "datatype": dbt_utils.type_string()},
{"name": "currency_rate", "datatype": dbt_utils.type_numeric()},
{"name": "date", "datatype": "date"},
{"name": "due_date", "datatype": "date"},
{"name": "fully_paid_on_date", "datatype": "date"},
{"name": "has_attachments", "datatype": "boolean"},
{"name": "line_amount_types", "datatype": dbt_utils.type_string()},
{"name": "reference", "datatype": dbt_utils.type_string()},
{"name": "remaining_credit", "datatype": dbt_utils.type_numeric()},
{"name": "sent_to_contact", "datatype": "boolean"},
{"name": "status", "datatype": dbt_utils.type_string()},
{"name": "sub_total", "datatype": dbt_utils.type_numeric()},
{"name": "total", "datatype": dbt_utils.type_numeric()},
{"name": "total_tax", "datatype": dbt_utils.type_numeric()},
{"name": "type", "datatype": dbt_utils.type_string()},
{"name": "updated_date_utc", "datatype": dbt_utils.type_timestamp()}
] %}

{{ return(columns) }}

{% endmacro %}
15 changes: 15 additions & 0 deletions models/src_xero.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,20 @@ sources:
- name: financial_year_end_day
description: Calendar day e.g. 0-31

- name: bank_transaction
description: Each record represents a bank transaction in Xero.
columns:
- name: bank_transaction_id
description: Xero identifier for the bank transaction.
- name: contact_id
description: The ID of the associated contact in Xero

- name: credit_note
description: Each record represents a credit note in Xero.
columns:
- name: credit_note_id
description: Xero identifier for the credit note.
- name: contact_id
description: The ID of the associated contact in Xero


30 changes: 30 additions & 0 deletions models/stg_xero__bank_transaction.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

with base as (

select *
from {{ ref('stg_xero__bank_transaction_tmp') }}

),

fields as (

select
{{
fivetran_utils.fill_staging_columns(
source_columns=adapter.get_columns_in_relation(ref('stg_xero__bank_transaction_tmp')),
staging_columns=get_bank_transaction_columns()
)
}}

from base
),

final as (

select
bank_transaction_id,
contact_id
from fields
)

select * from final
30 changes: 30 additions & 0 deletions models/stg_xero__credit_note.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

with base as (

select *
from {{ ref('stg_xero__credit_note_tmp') }}

),

fields as (

select
{{
fivetran_utils.fill_staging_columns(
source_columns=adapter.get_columns_in_relation(ref('stg_xero__credit_note_tmp')),
staging_columns=get_credit_note_columns()
)
}}

from base
),

final as (

select
credit_note_id,
contact_id
from fields
)

select * from final
1 change: 1 addition & 0 deletions models/tmp/stg_xero__bank_transaction_tmp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from {{ var('bank_transaction') }}
1 change: 1 addition & 0 deletions models/tmp/stg_xero__credit_note_tmp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from {{ var('credit_note') }}

0 comments on commit ce71bb3

Please sign in to comment.