def can_apply_to_multiple_schemata(sql, cursor):
parsed = sqlparse.parse(sql)
data = [
get_table_and_schema(statement, cursor)
for statement in parsed
]
if any(match is False for match in data):
return False
data = [part for part in data if part is not None]
# If all of our references to tables are shared, or schema-qualified, we
# can't apply multiple times.
if all(
is_shared_table(table_name) or schema_name
for (table_name, schema_name) in data
):
return False
return True
评论列表
文章目录