add accounts to staging

This commit is contained in:
Pablo Martin 2024-06-25 14:29:46 +02:00
parent 7a9c913b8a
commit 8dc31f3489
3 changed files with 48 additions and 0 deletions

View file

@ -23,3 +23,7 @@ sources:
identifier: bank_transactions
description: |
Bank transactions that have been created within our accounting books.
- name: accounts
identifier: accounts
description: |
Accounts from our accounting trees.

View file

@ -774,3 +774,18 @@ models:
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
description: ""
- name: stg_xero__accounts
description: |
Accounts in our accounting tree.
columns:
- name: id_account
data_type: character varying
description: Xero's unique identifier for the account.
tests:
- not_null
- unique
- name: account_code
data_type: character varying
description: Human readable account code.
tests:
- unique

View file

@ -0,0 +1,29 @@
with
raw_accounts as (select * from {{ source("xero", "accounts") }}),
stg_xero__accounts as (
select
{{ adapter.quote("AccountID") }} as id_account,
{{ adapter.quote("Code") }} as account_code,
{{ adapter.quote("Name") }} as account_name,
{{ adapter.quote("Type") }} as account_type,
{{ adapter.quote("Class") }} as account_class,
{{ adapter.quote("Status") }} as is_active,
{{ adapter.quote("TaxType") }} as account_tax_type,
{{ adapter.quote("Description") }} as account_description,
{{ adapter.quote("CurrencyCode") }} as account_currency_iso_4217,
{{ adapter.quote("ReportingCode") }} as reporting_code,
{{ adapter.quote("ReportingCodeName") }} as reporting_name,
{{ adapter.quote("SystemAccount") }} as system_account,
{{ adapter.quote("HasAttachments") }} as has_attachments,
{{ adapter.quote("BankAccountType") }} as bank_account_type,
{{ adapter.quote("BankAccountNumber") }} as bank_account_number,
{{ adapter.quote("ShowInExpenseClaims") }} as show_in_expense_claims,
{{ adapter.quote("EnablePaymentsToAccount") }}
as enable_payments_to_account,
{{ adapter.quote("UpdatedDateUTC") }} as updated_at_utc,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_accounts
)
select *
from stg_xero__accounts