Lake Formation Governed tables: truncate and reload?

0

Doing a POC with LF Governed table for a small dimension. I'd like to purge and reload the table each time it runs. I have tried to include a purge_table command within a governed table transaction but I receive the below error. I've tried adding a transactionId param to the purge_table command directly or within the options dict and neither has worked. Any ideas? Or anyone found a good way to truncate and reload a governed table?

"An error occurred while calling o119.purgeTable. Specify Either Transaction Id or Query AsOf Time"

tjtoll
gefragt vor 2 Jahren686 Aufrufe
2 Antworten
0

Hello,

I tried to purge the table and reload but unable to reload the table. Could you please share the purge_table command you are using for us to test ? Also, we recommend you to please open a support ticket with us so that we can get on a screen-share and assist you by checking your Lake Formation configuration and parameters used.

AWS
SUPPORT-TECHNIKER
beantwortet vor 2 Jahren
  • Thanks for your reply. See below. I'll also open a support ticket. Thank you

    dest_path = <s3 path> db = <database name> tbl = <table name>

    tx_id = glue_context.start_transaction(False)

    sink = glue_context.getSink( connection_type="s3", path=dest_path, enableUpdateCatalog=True, transactionId=tx_id ) sink.setFormat("glueparquet") sink.setCatalogInfo( catalogDatabase=db, catalogTableName=tbl )

    try: glue_context.purge_table(db, tbl, options={'transactionId':tx_id}) sink.writeFrame(glue_data_frame) glue_context.commit_transaction(tx_id) except Exception: glue_context.cancel_transaction(tx_id) raise job.commit()

0

In my POC to work with a clean LF table, I do the following:

import awswrangler as wr

# delete table if exists
wr.catalog.delete_table_if_exists(database=DATABASE, table=TABLE)

# clean up S3 location (delete_table do not remove data itself, just a metadata)
wr.s3.delete_objects(TABLE_LOCATION)

#Create a test table
wr.catalog.create_parquet_table(
        database=DATABASE,
        path=TABLE_LOCATION,
        table=TABLE,
        partitions_types = partition_types,
        columns_types=columns_types,
        description='Table for testing lakeformation',
        table_type = "GOVERNED",
        compression= 'snappy'
    )
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen