2024-06-25 13:37:53 +02:00
|
|
|
version: 2
|
|
|
|
|
|
|
|
|
|
models:
|
|
|
|
|
- name: int_xero__invoices
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_invoice
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
- name: int_xero__credit_notes
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_credit_note
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
- name: int_xero__invoice_line_items
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_line_item
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
- name: int_xero__credit_note_line_items
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_line_item
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
- name: int_xero__bank_transactions
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_bank_transaction
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
2024-07-08 17:06:23 +02:00
|
|
|
|
|
|
|
|
- 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: ""
|
|
|
|
|
|
2024-06-25 13:37:53 +02:00
|
|
|
|
|
|
|
|
|