mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-10 15:59:57 +00:00
Backup CLI case sensitivity fix for postgres sql (#12588)
This commit is contained in:
parent
75f819fb61
commit
bad506b5d9
@ -114,10 +114,10 @@ def get_hash_column_name(engine: Engine, table_name: str) -> Optional[str]:
|
|||||||
inspector = inspect(engine)
|
inspector = inspect(engine)
|
||||||
columns = inspector.get_columns(table_name)
|
columns = inspector.get_columns(table_name)
|
||||||
for column in columns:
|
for column in columns:
|
||||||
if column["name"] == FQN_HASH_COLUMN:
|
if column["name"].lower() == FQN_HASH_COLUMN.lower():
|
||||||
return FQN_HASH_COLUMN
|
return column["name"]
|
||||||
if column["name"] == NAME_HASH_COLUMN:
|
if column["name"].lower() == NAME_HASH_COLUMN.lower():
|
||||||
return NAME_HASH_COLUMN
|
return column["name"]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -204,6 +204,10 @@ def dump_entity_custom(engine: Engine, output: Path, inspector) -> None:
|
|||||||
file.write(insert)
|
file.write(insert)
|
||||||
|
|
||||||
|
|
||||||
|
def get_lower_table_names(tables):
|
||||||
|
return [table.lower() for table in tables]
|
||||||
|
|
||||||
|
|
||||||
def dump(engine: Engine, output: Path, schema: str = None) -> None:
|
def dump(engine: Engine, output: Path, schema: str = None) -> None:
|
||||||
"""
|
"""
|
||||||
Get all tables from the database and dump
|
Get all tables from the database and dump
|
||||||
@ -213,13 +217,15 @@ def dump(engine: Engine, output: Path, schema: str = None) -> None:
|
|||||||
tables = (
|
tables = (
|
||||||
inspector.get_table_names(schema) if schema else inspector.get_table_names()
|
inspector.get_table_names(schema) if schema else inspector.get_table_names()
|
||||||
)
|
)
|
||||||
|
lower_tables = get_lower_table_names(tables)
|
||||||
|
all_non_json_tables = (
|
||||||
|
get_lower_table_names(TABLES_DUMP_ALL)
|
||||||
|
+ get_lower_table_names(NOT_MIGRATE)
|
||||||
|
+ get_lower_table_names(CUSTOM_TABLES)
|
||||||
|
)
|
||||||
|
|
||||||
dump_json_tables = [
|
dump_json_tables = [
|
||||||
table
|
table for table in lower_tables if table not in all_non_json_tables
|
||||||
for table in tables
|
|
||||||
if table not in TABLES_DUMP_ALL
|
|
||||||
and table not in NOT_MIGRATE
|
|
||||||
and table not in CUSTOM_TABLES
|
|
||||||
]
|
]
|
||||||
|
|
||||||
dump_all(tables=list(TABLES_DUMP_ALL), engine=engine, output=output)
|
dump_all(tables=list(TABLES_DUMP_ALL), engine=engine, output=output)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user