Hi, I have some issue for connecting airbyte in da...
# integration-airbyte
a
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
Copy 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
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
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
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
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
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
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
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
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
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
e
Hi @Aiman, have you found a solution to your problem (dagster-airbyte cli from Docker/Dagster)? I'm also trying to do the same thing
a
No, I'm change my code from Dagster to my own custom Python module and Pub/Sub for orchestraction Airbyte @Edo
🌈 1