hi folks, airbyte newbie here, was hoping to get ...
# replication-ask-ai
n
hi folks, airbyte newbie here, was hoping to get some advice on how to make the most out of it. we're moving data from places like Hubspot into our postgres db. Our db is multi-tenant, with a single database and each table having "tenant id" field, which indicates the tenant - aka row level security if that means anything to you. I'd like to configure airbyte so that any data imported from Hubspot has an extra column that's "tenant id". any out of the box ways to achieve this? if not, what's the right extension point for this kind of functionality? thanks!
k
Hello and welcome to Airbyte! Based on the information provided in the extracts, it seems like you might be able to achieve your goal by using dbt transformations. dbt is a tool for performing transformations on your data once it's been loaded into your data warehouse. You can use it to add a "tenant id" column to your data after it's been imported from Hubspot. Here's a brief overview of how you might do this: 1. Set up your Hubspot source and Postgres destination in Airbyte. You can do this through the Airbyte UI or programmatically using the Airbyte API. 2. Once your data is being synced from Hubspot to Postgres, you can set up a dbt transformation to add the "tenant id" column. You would do this by writing a dbt model that adds the column to your data. Here's an example of how you might define such a model (this is just a starting point, you'll need to adjust it to suit your needs):
Copy code
sql {{ config(materialized='table') }}  SELECT *,        'your_tenant_id' as tenant_id FROM {{ source('your_hubspot_source', 'your_table') }}
This model would create a new table that includes all the data from your original table, plus a "tenant_id" column. 3. Once you've defined your dbt model, you can set up Airbyte to run it after each sync. You can do this by adding a new operation in the Airbyte UI and selecting dbt as the operator type. You'll need to provide the git URL of your dbt project and any additional dbt arguments you want to use. For more information on using dbt with Airbyte, you can check out this tutorial: [Build a single customer view with open-source tools](https://airbyte.com/tutorials/single-customer-view) Please note that this approach requires some familiarity with dbt. If you're new to dbt, you might find it helpful to go through their [getting started guide](https://docs.getdbt.com/tutorial/setting-up) first. I hope this helps! Let me know if you have any other questions.