This package models Xero data from Fivetran's connector. It uses data in the format described by this ERD.
The package’s primary focus is to transform the core tables into analytics-ready models, including a profit and loss report, general ledger, and balance sheet report.
This package contains transformation models, designed to work simultaneously with our Xero source package. A dependency on the source package is declared in this package's packages.yml
file, so it will automatically download when you run dbt deps
. The primary outputs of this package are described below.
model | description |
---|---|
xero__general_ledger | Each record represents a journal line item. Use the ledger to create the balance sheet and the profit and loss statement. |
xero__profit_and_loss_report | Each record represents a profit and loss line item at the month and account level. |
xero__balance_sheet_report | Each record represents the state of the balance sheet for a given account on a given month. |
xero__invoice_line_items | Each record represents an invoice line item enriched with the account, contact, and invoice information. |
If you are using multi-currency accounting in Xero, you are likely to have unrealized currency gains as part of your profit and loss statement. These gains/losses do not exist within the actual journals in Xero. As a result, you will find that those lines are missing from the outputs of this package. All realised currency gains will be present and your balance sheet will still balance.
Check dbt Hub for the latest installation instructions, or read the dbt docs for more information on installing packages.
Include in your packages.yml
packages:
- package: fivetran/xero
version: [">=0.4.0", "<0.5.0"]
By default, this package will look for your Xero data in the xero
schema of your target database. If this is not where your Xero data is,add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
config-version: 2
vars:
xero_schema: your_schema_name
xero_database: your_database_name
If you have multiple Xero connectors in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the source_relation
column of each model. To use this functionality, you will need to set either (note that you cannot use both) the union_schemas
or union_databases
variables:
# dbt_project.yml
...
config-version: 2
vars:
xero_source:
union_schemas: ['xero_us','xero_ca'] # use this if the data is in different schemas/datasets of the same database/project
union_databases: ['xero_us','xero_ca'] # use this if the data is in different databases/projects but uses the same schema name
When setting up your Xero connection in Fivetran, it is possible that not every table this package expects will be synced. This can occur because you either don't use that functionality in Xero or have actively decided to not sync some tables. In order to disable the relevant functionality in the package, you will need to add the relevant variables.
By default, all variables are assumed to be true
. You only need to add variables for the tables you would like to disable:
# dbt_project.yml
config-version: 2
vars:
xero__using_credit_note: false # default is true
xero__using_bank_transaction: false # default is true
For additional configurations for the source models, visit the Xero source package.
By default this package will build the Xero Source staging models within a schema titled (<target_schema> + _stg_xero
) and the Xero final transform models within a schema titled (<target_schema> + _xero
) in your target database.
To overwrite this behavior, add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
models:
xero:
+schema: my_new_final_models_schema # leave blank for just the target_schema
xero_source:
+schema: my_new_staging_models_schema # leave blank for just the target_schema
Don't see a model or specific metric you would have liked to be included? Notice any bugs when installing
and running the package? If so, we highly encourage and welcome contributions to this package!
Please create issues or open PRs against master
. See the Discourse post for information on how to contribute to a package.
This package has been tested on BigQuery, Snowflake, Postgres and Redshift.
- Provide feedback on our existing dbt packages or what you'd like to see next
- Have questions, feedback, or need help? Book a time during our office hours using Calendly or email us at solutions@fivetran.com
- Find all of Fivetran's pre-built dbt packages in our dbt hub
- Learn how to orchestrate your models with Fivetran Transformations for dbt Core™
- Learn more about Fivetran overall in our docs
- Check out Fivetran's blog
- Learn more about dbt in the dbt docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the dbt blog for the latest news on dbt's development and best practices