Skip to content

Commit

Permalink
Updated attributes-insert with construct query column mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
wagmarcel committed Nov 24, 2024
1 parent c3e8478 commit 6606d96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions semantic-model/shacl2flink/create_core_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def main():
{'type': 'STRING'},
{'attributeValue': 'STRING'},
{'datasetId': 'STRING'},
{'unitCode': 'STRING'}
{'unitCode': 'STRING'},
{'deleted': 'BOOLEAN'},
{'synced': 'BOOLEAN'}
]
kafka = {
'topic': kafka_topic_attributes_insert,
Expand All @@ -207,7 +209,7 @@ def main():
'json.fail-on-missing-field': False,
'json.ignore-parse-errors': True
}
primary_key = ['entityId', 'name', 'datasetId']
primary_key = ['id', 'datasetId']

print('---', file=f)
yaml.dump(utils.create_yaml_table(spec_name, connector, table,
Expand All @@ -231,6 +233,8 @@ def main():
{'attributeValue': 'STRING'},
{'datasetId': 'STRING'},
{'unitCode': 'STRING'},
{'deleted': 'BOOLEAN'},
{'synced': 'BOOLEAN'},
{'ts': "TIMESTAMP(3) METADATA FROM 'timestamp'"},
{'watermark': 'FOR `ts` AS `ts`'}
]
Expand Down
4 changes: 3 additions & 1 deletion semantic-model/shacl2flink/lib/sparql_to_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ def wrap_sql_construct(ctx, node):
construct_query += f'\'{attribute_type}\' as `type`,\n'
construct_query += f"{get_bound_trim_string(ctx, value_var)} as `attributeValue`,\n" # value
construct_query += '\'@none\' as `datasetId`,\n'
construct_query += 'CAST(NULL as STRING) as unitCode\n' # unitCode
construct_query += 'CAST(NULL as STRING) as unitCode,\n' # unitCode
construct_query += 'false as `deleted`,\n' # unitCode
construct_query += 'false as `synched`\n' # unitCode
construct_query += ',SQL_DIALECT_SQLITE_TIMESTAMP\n' # ts

construct_query += 'FROM ' + node['target_sql']
Expand Down

0 comments on commit 6606d96

Please sign in to comment.