excluded_tables= {"sessions","personal_access_tokens","jobs","cache","migrations","job_batches","cache_locks","password_reset_tokens"} # Example of tables to exclude
# Function to parse table structure
defparse_table_structure(sql):
tables= {}
table_name=None
enum_map= {}
forlineinsql.splitlines():
ifline.startswith("CREATE TABLE"):
match=re.search(r"`(\w+)`", line)
ifmatch:
table_name=match.group(1)
iftable_nameinexcluded_tables: # Skip the table entirely if excluded
table_name=None
else:
tables[table_name] = []
eliftable_nameand"`"inline:
column_match=re.search(r"`(\w+)` (\w+).*?", line)
ifcolumn_match:
column_name, column_type=column_match.groups()
ifcolumn_namenotinexcluded_columns: # Exclude specific columns