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

fixes schema merge behavior #621

Merged
merged 7 commits into from
Sep 12, 2023
Merged

Conversation

rudolfix
Copy link
Collaborator

Description

  • defines schemas, tables and column merge behavior
  • add case insensitive naming convention to weaviate
  • does not add default hints to columns

@netlify
Copy link

netlify bot commented Sep 11, 2023

Deploy Preview for dlt-hub-docs canceled.

Name Link
🔨 Latest commit 12e70dd
🔍 Latest deploy log https://app.netlify.com/sites/dlt-hub-docs/deploys/65003ee87748230008467985

@rudolfix rudolfix self-assigned this Sep 11, 2023
@rudolfix rudolfix requested a review from sh-rp September 11, 2023 22:30
@@ -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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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))}"
Copy link
Collaborator

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?

Copy link
Collaborator

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

Copy link
Collaborator Author

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

tests/load/weaviate/utils.py Outdated Show resolved Hide resolved
sh-rp
sh-rp previously approved these changes Sep 12, 2023
Copy link
Collaborator

@sh-rp sh-rp left a 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..

@rudolfix
Copy link
Collaborator Author

@sh-rp fixed the debug prints and merging

@rudolfix rudolfix merged commit 82d8b9d into devel Sep 12, 2023
@rudolfix rudolfix deleted the rfix/fixes-schema-merge-behavior branch September 12, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants