From 1fc16df2e25bbe3c8c4e47e288b3839157877e07 Mon Sep 17 00:00:00 2001 From: Ian Gow Date: Wed, 10 Jan 2024 19:55:40 -0500 Subject: [PATCH] Use process_sql for ownership. --- wrds2pg/wrds2pg.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wrds2pg/wrds2pg.py b/wrds2pg/wrds2pg.py index a651592..7cab513 100644 --- a/wrds2pg/wrds2pg.py +++ b/wrds2pg/wrds2pg.py @@ -752,12 +752,11 @@ def wrds_update(table_name, schema, create_role(engine, schema) sql = f'ALTER TABLE "{schema}"."{alt_table_name}" OWNER TO {schema}' - with engine.connect() as conn: - conn.execute(text(sql)) + process_sql(sql, engine) if not role_exists(engine, "%s_access" % schema): create_role(engine, "%s_access" % schema) - + sql = f'GRANT SELECT ON "{schema}"."{alt_table_name}"' sql += f' TO {schema}_access' res = process_sql(sql, engine)