Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix empty fields #1022

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cid/helpers/cur_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def get_sql_expression(self, field, field_type):
if not self.cur.column_exists(requirement):
missing_requirements.append(requirement)

if missing_requirements:
if missing_requirements and field_type.lower() in empty:
logger.trace(f'field {field} cannot be present as prereqs are missing in source cur: {missing_requirements}')
return empty[field_type.lower()]

Expand All @@ -508,10 +508,10 @@ def get_sql_expression(self, field, field_type):
keys_set = set(self.exposed_maps.get(field, set()))
keys_set.update(self.fields_to_expose_in_maps.get(map_field, set()))
for key in keys_set:
if f'{map_field}_{key}' in self.cur.fields:
if self.cur.column_exists(f'{map_field}_{key}'):
map_mapping[key] = f'{map_field}_{key}'
else:
map_mapping[key] = 'CAST(NULL as VARCHAR)'
map_mapping[key] = empty['string'] # all known maps have string vaules for now
if not map_mapping:
return 'cast(NULL AS MAP<VARCHAR, VARCHAR>)'
map_mapping = dict(sorted(map_mapping.items())) # ordered dict
Expand Down
Loading