From b08695795d2f0f675f79734c7bd81a93dd1b1b3b Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:13:37 +0200 Subject: [PATCH 01/12] line item level --- .../xero/int_xero__sales_denom_mart.sql | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 models/intermediate/xero/int_xero__sales_denom_mart.sql diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql new file mode 100644 index 0000000..5eb38db --- /dev/null +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -0,0 +1,50 @@ +with + int_xero__invoice_line_items as ( + select * from {{ ref("int_xero__invoice_line_items") }} + ), + int_xero__credit_note_line_items as ( + select * from {{ ref("int_xero__credit_note_line_items") }} + ) +select + id_invoice as id_document, + id_line_item as id_line_item, + id_item as id_item, + 'invoice' as document_type, + item_code as item_code, + quantity as quantity, + unit_amount as unit_amount, + line_amount_local_curr as line_amount_local_curr, + line_amount_in_gbp as line_amount_in_gbp, + line_amount_wo_taxes_local_curr, + line_amount_wo_taxes_in_gbp, + tax_amount_local_curr as tax_amount_local_curr, + tax_amount_in_gbp as tax_amount_in_gbp, + tax_type as tax_type, + invoice_currency_iso_4217 as invoice_currency_iso_4217, + line_description as line_description + +from int_xero__invoice_line_items + +union all + +select + + id_credit_note, + id_line_item, + id_item, + 'credit note' as document_type, + item_code, + quantity, + unit_amount, + -- We multiply all credit amounts by -1 so aggregations with + -- invoicing side work the way you would expect them to + line_amount_local_curr * -1, + line_amount_in_gbp * -1, + line_amount_wo_taxes_local_curr * -1, + line_amount_wo_taxes_in_gbp * -1, + tax_amount_local_curr * -1, + tax_amount_in_gbp * -1, + tax_type, + credit_note_currency_iso_4217, + line_description +from int_xero__credit_note_line_items From 0b05f8cb62ee391b0e6d5d91d400a93aaf78431c Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:16:21 +0200 Subject: [PATCH 02/12] join invoices --- .../xero/int_xero__sales_denom_mart.sql | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql index 5eb38db..a8de2b8 100644 --- a/models/intermediate/xero/int_xero__sales_denom_mart.sql +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -2,28 +2,31 @@ with int_xero__invoice_line_items as ( select * from {{ ref("int_xero__invoice_line_items") }} ), + int_xero__invoices as (select * from {{ ref("int_xero__invoices") }}), int_xero__credit_note_line_items as ( select * from {{ ref("int_xero__credit_note_line_items") }} - ) + ), + int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}) select - id_invoice as id_document, - id_line_item as id_line_item, - id_item as id_item, + ili.id_invoice as id_document, + ili.id_line_item as id_line_item, + ili.id_item as id_item, 'invoice' as document_type, - item_code as item_code, - quantity as quantity, - unit_amount as unit_amount, - line_amount_local_curr as line_amount_local_curr, - line_amount_in_gbp as line_amount_in_gbp, - line_amount_wo_taxes_local_curr, - line_amount_wo_taxes_in_gbp, - tax_amount_local_curr as tax_amount_local_curr, - tax_amount_in_gbp as tax_amount_in_gbp, - tax_type as tax_type, - invoice_currency_iso_4217 as invoice_currency_iso_4217, - line_description as line_description + ili.item_code as item_code, + ili.quantity as quantity, + ili.unit_amount as unit_amount, + ili.line_amount_local_curr as line_amount_local_curr, + ili.line_amount_in_gbp as line_amount_in_gbp, + ili.line_amount_wo_taxes_local_curr, + ili.line_amount_wo_taxes_in_gbp, + ili.tax_amount_local_curr as tax_amount_local_curr, + ili.tax_amount_in_gbp as tax_amount_in_gbp, + ili.tax_type as tax_type, + ili.invoice_currency_iso_4217 as invoice_currency_iso_4217, + ili.line_description as line_description -from int_xero__invoice_line_items +from int_xero__invoice_line_items ili +left join int_xero__invoices i on i.id_invoice = ili.id_invoice union all From 7fb5bc90d8765264e83c0b387469e068aa97e195 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:17:20 +0200 Subject: [PATCH 03/12] join credit notes --- .../xero/int_xero__sales_denom_mart.sql | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql index a8de2b8..093da4f 100644 --- a/models/intermediate/xero/int_xero__sales_denom_mart.sql +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -32,22 +32,23 @@ union all select - id_credit_note, - id_line_item, - id_item, + cnli.id_credit_note, + cnli.id_line_item, + cnli.id_item, 'credit note' as document_type, - item_code, - quantity, - unit_amount, + cnli.item_code, + cnli.quantity, + cnli.unit_amount, -- We multiply all credit amounts by -1 so aggregations with -- invoicing side work the way you would expect them to - line_amount_local_curr * -1, - line_amount_in_gbp * -1, - line_amount_wo_taxes_local_curr * -1, - line_amount_wo_taxes_in_gbp * -1, - tax_amount_local_curr * -1, - tax_amount_in_gbp * -1, - tax_type, - credit_note_currency_iso_4217, - line_description -from int_xero__credit_note_line_items + cnli.line_amount_local_curr * -1, + cnli.line_amount_in_gbp * -1, + cnli.line_amount_wo_taxes_local_curr * -1, + cnli.line_amount_wo_taxes_in_gbp * -1, + cnli.tax_amount_local_curr * -1, + cnli.tax_amount_in_gbp * -1, + cnli.tax_type, + cnli.credit_note_currency_iso_4217, + cnli.line_description +from int_xero__credit_note_line_items cnli +left join int_xero__credit_notes cn on cn.id_credit_note = cnli.id_credit_note From 43a7ead6d3c705aeebb2c915c55e5bca9bc88315 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:29:35 +0200 Subject: [PATCH 04/12] missing field in stg --- models/staging/xero/stg_xero__invoices.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/staging/xero/stg_xero__invoices.sql b/models/staging/xero/stg_xero__invoices.sql index a53db68..a3a2eff 100644 --- a/models/staging/xero/stg_xero__invoices.sql +++ b/models/staging/xero/stg_xero__invoices.sql @@ -5,7 +5,8 @@ with {{ adapter.quote("InvoiceID") }} as id_invoice, {{ adapter.quote("Reference") }} as reference, {{ adapter.quote("InvoiceNumber") }} as invoice_number, - {{ adapter.quote("Date") }} as invoice_issued_date_utc, + {{ adapter.quote("Date") }} as invoice_issued_at_utc, + cast({{ adapter.quote("Date") }} as date) as invoice_issued_date_utc, {{ adapter.quote("DueDate") }} as invoice_due_date_utc, {{ adapter.quote("FullyPaidOnDate") }} as was_fully_paid_on_date_utc, {{ adapter.quote("Type") }} as invoice_type, From ff09b2d7a46614d056c581d1643dcd151f8c0e1d Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:31:53 +0200 Subject: [PATCH 05/12] propagate field to int --- models/intermediate/xero/int_xero__invoices.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/intermediate/xero/int_xero__invoices.sql b/models/intermediate/xero/int_xero__invoices.sql index 5b7f8d2..95351a2 100644 --- a/models/intermediate/xero/int_xero__invoices.sql +++ b/models/intermediate/xero/int_xero__invoices.sql @@ -5,6 +5,7 @@ select full_contact_details ->> 'ContactID' as id_contact, reference, invoice_number, + invoice_issued_at_utc, invoice_issued_date_utc, invoice_due_date_utc, was_fully_paid_on_date_utc, From da7b931e8e3bd567503aa56b3e474c2bdf5373c8 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:47:44 +0200 Subject: [PATCH 06/12] include header data --- .../xero/int_xero__sales_denom_mart.sql | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql index 093da4f..0015ea6 100644 --- a/models/intermediate/xero/int_xero__sales_denom_mart.sql +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -8,10 +8,9 @@ with ), int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}) select - ili.id_invoice as id_document, ili.id_line_item as id_line_item, ili.id_item as id_item, - 'invoice' as document_type, + 'invoice' as document_class, ili.item_code as item_code, ili.quantity as quantity, ili.unit_amount as unit_amount, @@ -23,7 +22,27 @@ select ili.tax_amount_in_gbp as tax_amount_in_gbp, ili.tax_type as tax_type, ili.invoice_currency_iso_4217 as invoice_currency_iso_4217, - ili.line_description as line_description + ili.line_description as line_description, + + i.id_invoice as id_document, + i.id_contact as id_contact, + i.reference as reference, + i.invoice_number as document_number, + i.invoice_issued_at_utc as document_issued_at_utc, + i.invoice_issued_date_utc as document_issued_date_utc, + i.invoice_type as document_type, + i.invoice_currency_iso_4217 as document_currency_iso_4217, + i.exchange_rate_to_gbp as exchange_rate_to_gbp, + i.invoice_status as document_status, + i.line_amount_tax_inclusiveness as line_amount_tax_inclusiveness, + i.total_amount_local_curr as header_total_amount_local_curr, + i.total_amount_in_gbp as header_total_amount_in_gbp, + i.total_amount_wo_tax_local_curr as header_total_amount_wo_tax_local_curr, + i.total_amount_wo_tax_in_gbp as header_total_amount_wo_tax_in_gbp, + i.total_tax_local_curr as header_total_tax_local_curr, + i.total_tax_in_gbp as header_total_tax_in_gbp, + i.total_due_local_curr as header_total_due_local_curr, + i.total_due_in_gbp as header_total_due_in_gbp from int_xero__invoice_line_items ili left join int_xero__invoices i on i.id_invoice = ili.id_invoice @@ -32,10 +51,9 @@ union all select - cnli.id_credit_note, cnli.id_line_item, cnli.id_item, - 'credit note' as document_type, + 'credit note' as document_class, cnli.item_code, cnli.quantity, cnli.unit_amount, @@ -49,6 +67,27 @@ select cnli.tax_amount_in_gbp * -1, cnli.tax_type, cnli.credit_note_currency_iso_4217, - cnli.line_description + cnli.line_description, + + cn.id_credit_note, + cn.id_contact, + cn.reference, + cn.credit_note_number, + cn.credit_note_issued_at_utc, + cn.credit_note_issued_date_utc, + cn.credit_note_type, + cn.credit_note_currency_iso_4217, + cn.exchange_rate_to_gbp, + cn.credit_note_status, + cn.line_amount_tax_inclusiveness, + cn.total_amount_local_curr * -1, + cn.total_amount_in_gbp * -1, + cn.subtotal_local_curr * -1, + cn.subtotal_in_gbp * -1, + cn.total_tax_local_curr * -1, + cn.total_tax_in_gbp * -1, + cn.remaining_credit_local_curr * -1, + cn.remaining_credit_in_gbp * -1 + from int_xero__credit_note_line_items cnli left join int_xero__credit_notes cn on cn.id_credit_note = cnli.id_credit_note From 42811b6c7ef430549b77d5def3ec2a75588ad1dd Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:48:39 +0200 Subject: [PATCH 07/12] propagate field in reporting layer --- models/reporting/xero/xero__invoices.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/reporting/xero/xero__invoices.sql b/models/reporting/xero/xero__invoices.sql index 84e4afc..e7d08f2 100644 --- a/models/reporting/xero/xero__invoices.sql +++ b/models/reporting/xero/xero__invoices.sql @@ -5,6 +5,7 @@ select id_contact as id_contact, reference as reference, invoice_number as invoice_number, + invoice_issued_at_utc as invoice_issued_at_utc, invoice_issued_date_utc as invoice_issued_date_utc, invoice_due_date_utc as invoice_due_date_utc, was_fully_paid_on_date_utc as was_fully_paid_on_date_utc, From a79288a657e35c428fe3a71f8560210165f69ad4 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 16:55:46 +0200 Subject: [PATCH 08/12] add contact data --- .../xero/int_xero__sales_denom_mart.sql | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql index 0015ea6..f4ac9be 100644 --- a/models/intermediate/xero/int_xero__sales_denom_mart.sql +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -6,7 +6,8 @@ with int_xero__credit_note_line_items as ( select * from {{ ref("int_xero__credit_note_line_items") }} ), - int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}) + int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}), + int_xero__contacts as (select * from {{ ref("int_xero__contacts") }}) select ili.id_line_item as id_line_item, ili.id_item as id_item, @@ -25,7 +26,6 @@ select ili.line_description as line_description, i.id_invoice as id_document, - i.id_contact as id_contact, i.reference as reference, i.invoice_number as document_number, i.invoice_issued_at_utc as document_issued_at_utc, @@ -42,10 +42,15 @@ select i.total_tax_local_curr as header_total_tax_local_curr, i.total_tax_in_gbp as header_total_tax_in_gbp, i.total_due_local_curr as header_total_due_local_curr, - i.total_due_in_gbp as header_total_due_in_gbp + i.total_due_in_gbp as header_total_due_in_gbp, + + c.id_contact as id_contact, + c.id_deal as id_deal, + c.contact_name as contact_name from int_xero__invoice_line_items ili left join int_xero__invoices i on i.id_invoice = ili.id_invoice +left join int_xero__contacts c on c.id_contact = i.id_contact union all @@ -70,7 +75,6 @@ select cnli.line_description, cn.id_credit_note, - cn.id_contact, cn.reference, cn.credit_note_number, cn.credit_note_issued_at_utc, @@ -87,7 +91,12 @@ select cn.total_tax_local_curr * -1, cn.total_tax_in_gbp * -1, cn.remaining_credit_local_curr * -1, - cn.remaining_credit_in_gbp * -1 + cn.remaining_credit_in_gbp * -1, + + c.id_contact, + c.id_deal, + c.contact_name from int_xero__credit_note_line_items cnli left join int_xero__credit_notes cn on cn.id_credit_note = cnli.id_credit_note +left join int_xero__contacts c on c.id_contact = cn.id_contact From 6fcc9fde160a8d6c2207d9c70d7348815728a330 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 17:06:23 +0200 Subject: [PATCH 09/12] schema --- models/intermediate/xero/schema.yaml | 171 +++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/models/intermediate/xero/schema.yaml b/models/intermediate/xero/schema.yaml index aa1b3e3..ba3b87b 100644 --- a/models/intermediate/xero/schema.yaml +++ b/models/intermediate/xero/schema.yaml @@ -31,5 +31,176 @@ models: tests: - not_null - unique + + - name: int_xero__sales_denom_mart + description: | + This table is a denormalized mix of all invoices and credit notes data. + + It is built by creating a snowflake schema for the invoicing area and + another one for the crediting area. In both cases, the cardinality is + 1:* between line items and documents, and 1:* between documents and + contacts. Then, the invoice and credit note side get unioned to be stored + in a single structure. The only transformation that happens differently + across both is that credit note amounts get their sign reversed (* -1) so + that aggregations happen naturally (credit amounts subtract from invoice + amounts). The final granularity of the table is on the line item level. + + The word _document_ in the context of this table encompasses both invoices + and credit notes. + + The source of amounts is identifiable by their prefix. `line_` amount + fields come from the line items data, while `header_` fields come from the + document level data. Aggregating line fields can be done without worries. + Document level data can't be summed or averaged since it's duplicated per + line item, so be careful with it. + + columns: + - name: id_line_item + data_type: text + description: "" + tests: + - not_null + - unique + + - name: id_item + data_type: text + description: "" + + - name: document_class + data_type: text + description: "" + + - name: item_code + data_type: text + description: "" + + - name: quantity + data_type: numeric + description: "" + + - name: unit_amount + data_type: numeric + description: "" + + - name: line_amount_local_curr + data_type: numeric + description: "" + + - name: line_amount_in_gbp + data_type: numeric + description: "" + + - name: line_amount_wo_taxes_local_curr + data_type: numeric + description: "" + + - name: line_amount_wo_taxes_in_gbp + data_type: numeric + description: "" + + - name: tax_amount_local_curr + data_type: numeric + description: "" + + - name: tax_amount_in_gbp + data_type: numeric + description: "" + + - name: tax_type + data_type: text + description: "" + + - name: invoice_currency_iso_4217 + data_type: character varying + description: "" + + - name: line_description + data_type: text + description: "" + + - name: id_document + data_type: character varying + description: "" + + - name: reference + data_type: character varying + description: "" + + - name: document_number + data_type: character varying + description: "" + + - name: document_issued_at_utc + data_type: timestamp with time zone + description: "" + + - name: document_issued_date_utc + data_type: date + description: "" + + - name: document_type + data_type: character varying + description: "" + + - name: document_currency_iso_4217 + data_type: character varying + description: "" + + - name: exchange_rate_to_gbp + data_type: numeric + description: "" + + - name: document_status + data_type: character varying + description: "" + + - name: line_amount_tax_inclusiveness + data_type: character varying + description: "" + + - name: header_total_amount_local_curr + data_type: numeric + description: "" + + - name: header_total_amount_in_gbp + data_type: numeric + description: "" + + - name: header_total_amount_wo_tax_local_curr + data_type: numeric + description: "" + + - name: header_total_amount_wo_tax_in_gbp + data_type: numeric + description: "" + + - name: header_total_tax_local_curr + data_type: numeric + description: "" + + - name: header_total_tax_in_gbp + data_type: numeric + description: "" + + - name: header_total_due_local_curr + data_type: numeric + description: "" + + - name: header_total_due_in_gbp + data_type: numeric + description: "" + + - name: id_contact + data_type: character varying + description: "" + + - name: id_deal + data_type: text + description: "" + + - name: contact_name + data_type: character varying + description: "" + \ No newline at end of file From 003c7cd18576b37c5ed0b38643bcec625780e208 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 17:26:02 +0200 Subject: [PATCH 10/12] remove duplicated currency field --- models/intermediate/xero/int_xero__sales_denom_mart.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/models/intermediate/xero/int_xero__sales_denom_mart.sql b/models/intermediate/xero/int_xero__sales_denom_mart.sql index f4ac9be..13331a7 100644 --- a/models/intermediate/xero/int_xero__sales_denom_mart.sql +++ b/models/intermediate/xero/int_xero__sales_denom_mart.sql @@ -22,7 +22,6 @@ select ili.tax_amount_local_curr as tax_amount_local_curr, ili.tax_amount_in_gbp as tax_amount_in_gbp, ili.tax_type as tax_type, - ili.invoice_currency_iso_4217 as invoice_currency_iso_4217, ili.line_description as line_description, i.id_invoice as id_document, @@ -71,7 +70,6 @@ select cnli.tax_amount_local_curr * -1, cnli.tax_amount_in_gbp * -1, cnli.tax_type, - cnli.credit_note_currency_iso_4217, cnli.line_description, cn.id_credit_note, From 00b7940c2587ec3fb0b7ee9b229cd7327b99c423 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 17:26:10 +0200 Subject: [PATCH 11/12] more schema, more tests --- models/intermediate/xero/schema.yaml | 50 ++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/models/intermediate/xero/schema.yaml b/models/intermediate/xero/schema.yaml index ba3b87b..eea5685 100644 --- a/models/intermediate/xero/schema.yaml +++ b/models/intermediate/xero/schema.yaml @@ -44,6 +44,8 @@ models: across both is that credit note amounts get their sign reversed (* -1) so that aggregations happen naturally (credit amounts subtract from invoice amounts). The final granularity of the table is on the line item level. + Invoice and credit note records can be told apart through the + document_class field. The word _document_ in the context of this table encompasses both invoices and credit notes. @@ -53,6 +55,9 @@ models: document level data. Aggregating line fields can be done without worries. Document level data can't be summed or averaged since it's duplicated per line item, so be careful with it. + + Fields are not documented here: you can find more details in upstream + models. columns: - name: id_line_item @@ -68,7 +73,14 @@ models: - name: document_class data_type: text - description: "" + description: | + Indicates whether the record belongs in an invoice or a credit note. + tests: + - not_null + - accepted_values: + values: + - 'invoice' + - 'credit note' - name: item_code data_type: text @@ -110,9 +122,14 @@ models: data_type: text description: "" - - name: invoice_currency_iso_4217 + - name: document_currency_iso_4217 data_type: character varying description: "" + tests: + - not_null + - length_between: + min_length: 3 + max_length: 3 - name: line_description data_type: text @@ -121,6 +138,8 @@ models: - name: id_document data_type: character varying description: "" + tests: + - not_null - name: reference data_type: character varying @@ -141,6 +160,14 @@ models: - name: document_type data_type: character varying description: "" + tests: + - not_null + - accepted_values: + values: + - "ACCREC" + - "ACCPAY" + - "ACCRECCREDIT" + - "ACCPAYCREDIT" - name: document_currency_iso_4217 data_type: character varying @@ -149,14 +176,33 @@ models: - name: exchange_rate_to_gbp data_type: numeric description: "" + tests: + - not_null + - not_negative - name: document_status data_type: character varying description: "" + tests: + - not_null + - accepted_values: + values: + - PAID + - VOIDED + - DRAFT + - DELETED + - AUTHORISED + - SUBMITTED - name: line_amount_tax_inclusiveness data_type: character varying description: "" + tests: + - accepted_values: + values: + - Inclusive + - Exclusive + - NoTax - name: header_total_amount_local_curr data_type: numeric From fad85691f31abbadfa04406674150980d3ccdba1 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 8 Jul 2024 17:52:15 +0200 Subject: [PATCH 12/12] typo in docs --- models/intermediate/xero/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/intermediate/xero/schema.yaml b/models/intermediate/xero/schema.yaml index eea5685..f9fcc1c 100644 --- a/models/intermediate/xero/schema.yaml +++ b/models/intermediate/xero/schema.yaml @@ -38,7 +38,7 @@ models: It is built by creating a snowflake schema for the invoicing area and another one for the crediting area. In both cases, the cardinality is - 1:* between line items and documents, and 1:* between documents and + *:1 between line items and documents, and *:1 between documents and contacts. Then, the invoice and credit note side get unioned to be stored in a single structure. The only transformation that happens differently across both is that credit note amounts get their sign reversed (* -1) so