Steven Murphy
08/08/2023, 12:13 PMdagster dev
with a debugger?
My use case is that I'm testing the Airbyte integration with Dagster, using the load_assets_from_airbyte_instance
function. If I run dagster dev -f airbyte.py
(without the if main part below), the connection_filter_print
function will print. If I try and run it just as a Python file, it does not print.
I think can get away with doing print statements, though feels a bit old school. Would be nice to test this without having to fire up dagster dev
each time.
from dagster_airbyte import load_assets_from_airbyte_instance
def connection_filter_print(meta: Optional[AirbyteConnectionMetadata]) -> bool:
print(f"meta - [{meta}]")
return True
if __name__ == "__main__":
airbyte_assets = load_assets_from_airbyte_instance(airbyte_instance,
connection_filter=connection_filter_print,
)
defs = Definitions(assets=[airbyte_assets])
Zach
08/08/2023, 3:28 PMdagster job execute ...
on a specific job with run configuration, which allowed them to use Pycharm's built-in debuggerZach
08/08/2023, 3:49 PMZach
08/08/2023, 3:53 PMfrom <your_library> import airbyte_asset # this could be one or many assets
from dagster import materialize_to_memory
def test_asset():
materialize_to_memory([airbyte_asset])
then if you run the test you should be able to sue the debugger with breakpoints in your asset. As a bonus you get an end-to-end test that you can add to your CI/CD test suite.Tim Castillo
08/08/2023, 3:54 PMSteven Murphy
08/08/2023, 4:50 PMalexander jacob
01/29/2024, 1:10 PMdagster job execute
works fine to debug with pycharm :-)