<@U04S8PLJWMT> Hey If i have a mysql db as the tra...
# ask-ai
o
@kapa.ai Hey If i have a mysql db as the transactional db and I want to create a warehouse in postgres timescale db and I am using airbyte as the connector, airbyte created type 2 scd tables but based on the 3rd normal form structure of the transactional db which doesnt conform with the star schema, is it possible to first transform the structure of my transactional db to a star schema then populate the scd tables
k
Airbyte, by default, replicates your transactional MySQL database into your destination (e.g., Postgres/TimescaleDB) using the same schema structure as the source—typically 3rd normal form. When you enable features like "Incremental - Deduped History," Airbyte creates type 2 SCD (_scd) tables, but these are still based on the original source schema, not a star schema. To transform your data into a star schema before populating SCD tables, you would need to perform additional transformations after the initial sync. Airbyte itself does not natively support transforming your data model from 3NF to a star schema during the sync process. However, Airbyte Cloud integrates natively with dbt, allowing you to run dbt models for post-sync transformations. With dbt, you can reshape your normalized tables into a star schema and then apply further SCD logic if needed. This workflow would look like: 1. Use Airbyte to replicate your MySQL data to Postgres/TimescaleDB (raw and normalized tables). 2. Use dbt to transform the normalized tables into a star schema. 3. Optionally, use dbt to implement SCD logic on your star schema tables. Note: The ability to use custom dbt transformations is only available in Airbyte Cloud, not in Airbyte Open-Source. In Airbyte Open-Source, custom transformations are not natively supported, so you would need to orchestrate dbt runs separately after Airbyte syncs complete [see details](https://docs.airbyte.com/platform/using-airbyte/core-concepts#custom-transformations). In summary, Airbyte does not directly support transforming your transactional schema to a star schema before SCD table creation. You must use dbt (or a similar tool) for this transformation step after the initial sync.
o
@kapa.ai would dbt transform the scd tables too that were created from airbyte?
k
A message from kapa.ai
A message from kapa.ai
dbt can transform any tables in your destination, including the SCD (_scd) tables created by Airbyte, as long as you define those tables as sources in your dbt project. The typical workflow is: 1. Airbyte syncs your data and creates raw, normalized, and (if enabled) SCD tables in your destination. 2. In dbt, you define these tables (including the _scd tables) as sources. 3. You can then build dbt models that reference and transform these SCD tables as needed. This approach is supported and recommended in several Airbyte tutorials, which describe creating dbt sources for Airbyte-managed tables and then building custom transformations on top of them [see example](https://airbyte.com/tutorials/airbyte-dbt-and-airflow-stack-with-snowflake). So, yes—dbt can transform the SCD tables created by Airbyte, provided you configure your dbt project to use them as sources and write the appropriate transformation models.
Yes, dbt can transform the SCD (_scd) tables created by Airbyte, as long as you define those tables as sources in your dbt project and build models that reference them. This approach is commonly recommended: after Airbyte syncs and creates the SCD tables in your destination, you use dbt to create sources for these tables and then apply your custom transformations as needed. This allows you to further process or reshape the SCD tables according to your analytics requirements [Airbyte, dbt and Airflow (ADA) Stack with Snowflake](https://airbyte.com/tutorials/airbyte-dbt-and-airflow-stack-with-snowflake). However, please note that the ability to run dbt transformations natively after Airbyte syncs is only available in Airbyte Cloud, not in Airbyte Open-Source [Custom Transformations](https://docs.airbyte.com/platform/using-airbyte/core-concepts#custom-transformations).
o
@kapa.ai then how would i do it with airbyte opensource
k
A message from kapa.ai
With Airbyte Open Source, you cannot natively trigger dbt transformations immediately after a sync, as custom transformations and dbt integration are only available in Airbyte Cloud. However, you can still achieve your goal by orchestrating your pipeline externally: 1. Run Airbyte Sync: Use Airbyte OSS to replicate your MySQL data to your Postgres/TimescaleDB destination. This will create the raw and SCD (_scd) tables based on your transactional schema. 2. Orchestrate dbt Separately: Use an external orchestrator such as Airflow, Dagster, or Prefect to trigger your dbt transformations after the Airbyte sync completes. In your dbt project, define the Airbyte-created tables (including _scd tables) as sources and build your transformation models on top of them. This approach is confirmed in community discussions and tutorials, where users are advised to use orchestrators to manage the workflow between Airbyte and dbt in the open-source setup [Github Issue: Is it possible to use OSS version with a self hosted dbt?](https://github.com/airbytehq/airbyte/issues/53605). Summary: - Airbyte OSS syncs your data and creates SCD tables. - Use an orchestrator (e.g., Airflow, Dagster, Prefect) to trigger dbt after sync. - dbt transforms the SCD tables as needed. There is no built-in way in Airbyte OSS to run dbt transformations automatically after a sync; external orchestration is required.