Skip to content

sjmunoz/dbt_xero_source

 
 

Repository files navigation

Apache License

Xero Source

This package models Xero data from Fivetran's connector. It uses data in the format described by this ERD.

Models

This package contains staging models, designed to work simultaneously with our Xero modeling package. The staging models name columns consistently across all packages:

  • Boolean fields are prefixed with is_ or has_.
  • ID primary keys are prefixed with the name of the table. For example, the campaign table's ID column is renamed campaign_id.

Installation Instructions

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_source
    version: [">=0.4.0", "<0.5.0"]

Configuration

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 

Unioning Multiple Xero Connectors

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

Disabling and Enabling Models

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

Contributions

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 main. See the Discourse post for information on how to contribute to a package.

Database Support

This package has been tested on BigQuery, Snowflake, Postgres and Redshift.

Resources:

About

Data source models for Fivetran's Xero connector built using dbt.

Resources

License

Stars

Watchers

Forks

Packages

No packages published