Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AwsWranglerDeltaLakeIOManager: write mode and schema mode error. #2

Open
CHRISCARLON opened this issue Aug 18, 2024 · 0 comments
Open
Assignees
Labels
invalid This doesn't seem right

Comments

@CHRISCARLON
Copy link
Member

CHRISCARLON commented Aug 18, 2024

Issue

You can't have the "mode" set as "append" if the "schema_mode" is set as "overwrite".

Will look into why.

Will add the error message later.

Have made all assets overwrite for now - but will look into adding schema mode as a decorator arg.

As some assets will need to be append rather than overwrite.

Code as is:

try:
            wr.s3.to_deltalake(
                df=obj,
                path=table_path,
                mode=write_option,
                schema_mode="overwrite",  # INCLUDE AS A DECORATOR ARG AT SOME POINT LIKE FOR MODE ABOVE
                s3_allow_unsafe_rename=True,
            )
            context.log.info(f"Data written to Delta Lake table at {table_path}")
        except (DeltaLakeWriteError, Exception) as e:
            raise e

Fix

Schema mode arg would go:

@asset(
    group_name="energy_assets",
    io_manager_key="DeltaLake",
    metadata={"mode": "overwrite"},
    **ARG HERE**
    ins={"entsog_gas_uk_data_bronze": AssetIn("entsog_gas_uk_data_bronze")},
    required_resource_keys={"slack"}
)
@with_slack_notification("ENTSOG Gas UK data")
def entsog_gas_uk_data_silver(
    context: AssetExecutionContext, entsog_gas_uk_data_bronze
):
@CHRISCARLON CHRISCARLON added the invalid This doesn't seem right label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants