https://dagster.io/ logo
Title
a

Aiman

05/16/2023, 4:22 AM
Hi, I have some issue for connecting airbyte in dagster with error log
ValueError: Airbyte connections are not in sync with provided configuration
. I run it from my docker compose in virtual machine. Any insight from it? I will share my code as well
Here's my code
from dagster import asset, repository
from dagster_airbyte import (
    AirbyteManagedElementReconciler,
    airbyte_resource,
    AirbyteConnection,
    AirbyteSyncMode,
    load_assets_from_connections,
)
from dagster_airbyte.managed.generated.sources import PokeapiSource
from dagster_airbyte.managed.generated.destinations import BigqueryDestination
airbyte_instance = airbyte_resource.configured(
    {
        "host": HOST,
        "port": "8000",
        "username": "airbyte",
        "password": "password",
    }
)
pokeapi_source = PokeapiSource(
    name="pokeapi_to_bq",
    pokemon_name="snorlax",
)
bigquery_destination = BigqueryDestination(
    name="bigquery",
    project_id="winter-cab-380906",
    dataset_location="asia-southeast2",
    dataset_id="airbyte_testing",
    loading_method=BigqueryDestination.StandardInserts(),
    credentials_json='credentials.json', # dari mana?
)
stargazer_connection = AirbyteConnection(
    name="fetch_stargazer",
    source=pokeapi_source,
    destination=bigquery_destination,
    stream_config={"stargazers": AirbyteSyncMode.incremental_append_dedup()},
    normalize_data=True,
)
airbyte_reconciler = AirbyteManagedElementReconciler(
    airbyte=airbyte_instance,
    connections=[stargazer_connection],
)
# load airbyte connection from above pythonic definitions
airbyte_assets = load_assets_from_connections(
    airbyte=airbyte_instance,
    connections=[stargazer_connection],
    key_prefix=["bigquery"],
)
j

Joel Olazagasti

05/16/2023, 3:53 PM
That usually means you're defining connections that you haven't pushed to your Airbyte instance with the CLI command. Dagster expects all of the assets you're loading actively exist in Airbyte when you run Dagster
a

Aiman

05/16/2023, 4:47 PM
Thank you for your reply @Joel Olazagasti will try it later. But I have question, What if I want to make the assets from dagster? Is it possible to make a connection in airbyte without the GUI?
j

Joel Olazagasti

05/16/2023, 4:52 PM
https://docs.dagster.io/guides/dagster/airbyte-ingestion-as-code You can apply the changes through the cli using the code you've already written above. You just have to apply before your code definitions are loaded to keep Dagster and Airbyte in sync
a

Aiman

05/16/2023, 4:58 PM
Sorry, I still confuse for next step. What do you mean by "have to apply"?
Is it must to create connections in Airbyte by UI? Cmiiw
j

Joel Olazagasti

05/16/2023, 5:02 PM
You don't have to use the UI. It's applied by CLI command. You can refer to steps 4 & 5 in the documentation above
a

Aiman

05/16/2023, 5:12 PM
So you mean CLI command in your first reply is do dagster-airbyte apply and check? After that connections in Airbyte will be run by Dagster as orchestration? Cmiiw
j

Joel Olazagasti

05/16/2023, 6:54 PM
Yes, the
apply
command is what takes the configuration you've defined in Dagster and pushes it to Airbyte. You will need to run that every time you make a change to your Airbyte definitions in you Dagster code. The Dagster application itself does not automatically apply your configurations to the Airbyte application, it just expects them to be there as defined. It is up to you, or your CI pipeline, to make sure those configurations are applied.
a

Aiman

05/17/2023, 2:09 PM
I have some question from my problem, maybe you can answer, here's my list : • Dagster running with Docker compose • We want to add airbyte connection fully from dagster without manual intervention • Can we use dagster-airbyte cli (step 4 and 5 at https://docs.dagster.io/guides/dagster/airbyte-ingestion-as-code#step-4-validate-changes ) from inside Dagster? (i.e. using dagster-shell or some kind of SDK?)
j

Joel Olazagasti

05/17/2023, 2:28 PM
I've never run Dagster with Docker compose. If you're having any specific issues Im sure you can post them in #dagster-support. You'll always need some separate process to deploy your Airbyte configuration before you load new code into the Dagster process that relies on new connection definitions. If you don't, Dagster will just error like you saw above. If you want to automate the process, I would just build it into your deployment process