Ohad
04/10/2023, 10:46 PMdagster dev
I get the following error /home/byteuser/venv/lib/python3.10/site-packages/dagster/_core/workspace/context.py:591: UserWarning: Error loading repository location hillsg_dagster:dagster._core.errors.DagsterInvalidDefinitionError: "src_airtable__hg_data_entry/sub_learning_areas" is not a valid name in Dagster. Names must be in regex ^[A-Za-z0-9_]+$.
Looking into it, the Stream name for an Airbyte connection with Airtable is "src_airtable__hg_data_entry/sub_learning_areas"
I can't control the stream name, this is how Airbyte resolves the Base/Table name with the Airbyte connector. When the table is created in the DB, it changes "/" to "_". Any idea how can I work around this issue?Jon Erik Kemi Warghed
04/12/2023, 6:01 AMAdam Bloom
04/12/2023, 2:12 PMOhad
04/12/2023, 8:33 PMairbyte_assets = load_assets_from_airbyte_instance(
AIRBYTE_INSTANCE,
key_prefix=['sources'],
connection_to_asset_key_fn=?)
Hiroto Yamakawa
07/04/2023, 1:16 PMOhad
07/08/2023, 12:16 AMAdam Bloom
07/08/2023, 12:21 AMAdam Bloom
07/08/2023, 12:24 AM/
with another valid character (i.e. _
), you could use lambda _, table: AssetKey(path=[table.replace('/','_')])
The first argument to that lambda is additional metadata if you want to use it in your asset keys.Ohad
07/08/2023, 12:55 AMHiroto Yamakawa
07/11/2023, 2:07 PMfrom dagster_airbyte.asset_defs import _clean_name
def connection_to_asset_key_function(meta, name):
for item in meta.stream_data:
item['stream']['name'] = _clean_name(item['stream']['name'])
return AssetKey([meta.name, name])
and then in
dagster_airbyte/asset_defs.py
( a file from the package):
def parse_stream_tables(
self, return_normalization_tables: bool = False
) -> Mapping[str, AirbyteTableMetadata]:
[...]
for stream in enabled_streams:
name = _clean_name(cast(str, stream.get("stream", {}).get("name")))
[...]
that way, the files with rejected charaters were loaded into DagsterHiroto Yamakawa
07/11/2023, 2:11 PMdagster_airbyte/asset_defs.py
is actually enough, since stream parsing happens first. I guess this would need a PRHiroto Yamakawa
07/11/2023, 2:12 PMOhad
07/21/2023, 8:57 PM