Skip to content

Commit

Permalink
fix gcs delta tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Oct 11, 2024
1 parent 50a5d47 commit 54a9d6a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/load/test_read_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,14 @@ def double_items():
loads_table = pipeline._dataset()[pipeline.default_schema.loads_table_name]
loads_table.fetchall()

# check dataset factory
dataset = dlt.dataset(
destination=destination_config.destination_type, dataset_name=pipeline.dataset_name
destination_for_dataset = (
alternate_access_pipeline.destination
if alternate_access_pipeline
else destination_config.destination_type
)

# check dataset factory
dataset = dlt.dataset(destination=destination_for_dataset, dataset_name=pipeline.dataset_name)
# verfiy that sql client and schema are lazy loaded
assert not dataset._schema
assert not dataset._sql_client
Expand All @@ -225,15 +229,15 @@ def double_items():

# check that schema is loaded by name
dataset = dlt.dataset(
destination=destination_config.destination_type,
destination=destination_for_dataset,
dataset_name=pipeline.dataset_name,
schema=pipeline.default_schema_name,
)
assert dataset.schema.tables["items"]["write_disposition"] == "replace" # type: ignore

# check that schema is not loaded when wrong name given
dataset = dlt.dataset(
destination=destination_config.destination_type,
destination=destination_for_dataset,
dataset_name=pipeline.dataset_name,
schema="wrong_schema_name",
)
Expand All @@ -242,15 +246,15 @@ def double_items():

# check that schema is loaded if no schema name given
dataset = dlt.dataset(
destination=destination_config.destination_type,
destination=destination_for_dataset,
dataset_name=pipeline.dataset_name,
)
assert dataset.schema.name == pipeline.default_schema_name # type: ignore
assert dataset.schema.tables["items"]["write_disposition"] == "replace" # type: ignore

# check that there is no error when creating dataset without schema table
dataset = dlt.dataset(
destination=destination_config.destination_type,
destination=destination_for_dataset,
dataset_name="unknown_dataset",
)
assert dataset.schema.name == "unknown_dataset" # type: ignore
Expand All @@ -269,7 +273,7 @@ def double_items():
client.update_stored_schema()

dataset = dlt.dataset(
destination=destination_config.destination_type,
destination=destination_for_dataset,
dataset_name=pipeline.dataset_name,
)
assert dataset.schema.name == "some_other_schema" # type: ignore
Expand Down

0 comments on commit 54a9d6a

Please sign in to comment.