Handle . in column names (#989)

* Handle . in column names

* Handle . for profiling
This commit is contained in:
Tom Vijlbrief 2021-11-01 15:22:40 +01:00 committed by GitHub
parent 9b7d3e313f
commit 0c23b68d40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -160,6 +160,11 @@ class MetadataRestSink(Sink):
table_id=created_table.id, sample_data=table_and_db.table.sampleData
)
if table_and_db.table.tableProfile is not None:
for tp in table_and_db.table.tableProfile:
for pd in tp:
if pd[0] == "columnProfile":
for col in pd[1]:
col.name = col.name.replace(".", "_DOT_")
self.client.ingest_table_profile_data(
table_id=created_table.id,
table_profile=table_and_db.table.tableProfile,

View File

@ -177,7 +177,9 @@ class SQLSource(Source):
query = self.config.query.format(schema, table)
logger.info(query)
results = self.connection.execute(query)
cols = list(results.keys())
cols = []
for col in results.keys():
cols.append(col.replace(".", "_DOT_"))
rows = []
for r in results:
row = list(r)
@ -347,7 +349,8 @@ class SQLSource(Source):
try:
for column in columns:
if "." in column["name"]:
continue
logger.info(f"Found '.' in {column['name']}")
column["name"] = column["name"].replace(".", "_DOT_")
children = None
data_type_display = None
col_data_length = None