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

How to run CALL system.sync_partition_metadata #126

Open
shivamtundele opened this issue Jun 2, 2023 · 1 comment
Open

How to run CALL system.sync_partition_metadata #126

shivamtundele opened this issue Jun 2, 2023 · 1 comment

Comments

@shivamtundele
Copy link

shivamtundele commented Jun 2, 2023

Hi
I am trying to run below query to update partitions of the schema after a table update. But fetchone and fetchall are causing errors as this updating partition statement is not getting executed and returns error coz its expecting rows to return with that query. Is there any other method to run this statement?

presto_connection = self._load_presto_connection(
use_presto_service_account=self.use_presto_service_account
)
cursor = presto_connection.cursor()
query = f"CALL system.sync_partition_metadata(schema_name => '{schema_name}', table_name => '{table_name}', mode => 'add')"
DebugLogger.info(f"Updating schema paritition for {schema_name}.{table_name}:\n {query}")
cursor.execute(query)
cursor.fetchone()
DebugLogger.info(f"Updated schema partition!")
presto_connection.close()

@shivamtundele
Copy link
Author

I also tried commit method on the presto connection but its not working either

    query = f"CALL system.sync_partition_metadata(schema_name => '{schema_name}', table_name => '{table_name}', mode => 'add')"
    DebugLogger.info(f"Updating schema paritition for {schema_name}.{table_name}:\n {query}")
    presto_connection.commit()
    DebugLogger.info(f"Updated schema partition!")
    presto_connection.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant