Benedikt Buchert

01/21/2023, 3:57 AM
Hi, How do I connect assets from Fivetran with DBT. Both of them do not get loaded with @asset. The examples I see in the docs were not really clear for me. I tried something like this: But the api for fivetran seems to work differently. Can someone give me an example and explain it like I’m 5? Do I have to connect each table one by one or is there an automatic way that finds the connection between each of the tables in Bigquery (DBT) and Fivetran?
For my understanding the key_prefix need to match for dbt and fivetran for that asset. Is there a way I can change the key_prefix coming from fivetran. I only see an option to change the prefix I don't see an option to replace it. I want to replace google_ads_123 coming from the connector name to google_ads.
Screenshot 2023-01-25 at 01.26.13.png
Screenshot 2023-01-25 at 01.27.46.png
Found the solution:
def connector_to_asset_key_fn(_, item_name):
    config = {
        "google_ads_123": "google_ads",
        "linkedin_123": "linkedin"
    path = item_name.split(".")
    path[0] = config[path[0]]
    return AssetKey(path=path)
Anf then:
fivetran_assets = load_assets_from_fivetran_instance(
❤️ 1

Nicolas May

02/15/2023, 11:00 PM
If you only had one schema, say
, another approach might be something like this:
connectors_to_include = ["my_conn"]

fivetran_assets = load_assets_from_fivetran_instance(
    connector_filter=lambda meta: in connectors_to_include,
    connector_to_asset_key_fn=lambda _, table: AssetKey(path=table.split(".")[-1]),
    key_prefix=["dbt_source", "google_ads"],