-
Notifications
You must be signed in to change notification settings - Fork 197
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
fixes schema merge behavior #621
Conversation
… conflicts + tests
…ding default hints
✅ Deploy Preview for dlt-hub-docs canceled.
|
@@ -66,7 +66,7 @@ def from_dict(cls, d: DictStrAny) -> "Schema": | |||
# verify schema | |||
utils.validate_stored_schema(stored_schema) | |||
# add defaults | |||
utils.apply_defaults(stored_schema) | |||
stored_schema = utils.apply_defaults(stored_schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi this utils function changes the stored schema itself, not sure if you maybe wanted to clone it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it should happen in place
@@ -105,7 +105,7 @@ def start_file_load(self, table: TTableSchema, file_path: str, load_id: str) -> | |||
def _get_column_def_sql(self, c: TColumnSchema) -> str: | |||
hints_str = " ".join(self.active_hints.get(h, "") for h in self.active_hints.keys() if c.get(h, False) is True) | |||
column_name = self.capabilities.escape_identifier(c["name"]) | |||
return f"{column_name} {self._to_db_type(c['data_type'])} {hints_str} {self._gen_not_null(c['nullable'])}" | |||
return f"{column_name} {self._to_db_type(c['data_type'])} {hints_str} {self._gen_not_null(c.get('nullable', True))}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the nullable always be set in columns that are complete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question of course for all other destinations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one of the changes is to not add all the possible hints with default values. in case of nullable we indeed make an exception - (see new_table) I'd need to investigate more. but I think this is OK for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, I have 2 small questions, and there are a bunch of print statements, that you could remove. I ran this failing test locally and here it also work, I am not sure what is going on there..
@sh-rp fixed the debug prints and merging |
Description