Changeset View
Changeset View
Standalone View
Standalone View
swh/core/db/db_utils.py
Show First 20 Lines • Show All 683 Lines • ▼ Show 20 Lines | for sqlfile in sqlfiles: | ||||
subprocess.check_call(psql_command + ["-c", query]) | subprocess.check_call(psql_command + ["-c", query]) | ||||
flavor_set = True | flavor_set = True | ||||
if flavor is not None and not flavor_set: | if flavor is not None and not flavor_set: | ||||
logger.warn( | logger.warn( | ||||
"Asked for flavor %s, but module does not support database flavors", | "Asked for flavor %s, but module does not support database flavors", | ||||
flavor, | flavor, | ||||
) | ) | ||||
# Grant read-access to guest user on all tables of the schema (if possible) | |||||
with connect_to_conninfo(db_or_conninfo) as db: | |||||
try: | |||||
with db.cursor() as c: | |||||
query = "grant select on all tables in schema public to guest" | |||||
c.execute(query) | |||||
except Exception: | |||||
logger.warning("Grant read-only access to guest user failed. Skipping.") |