Skip to content

Commit

Permalink
Simplify null string handling
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Coetzee <[email protected]>
  • Loading branch information
Pipboyguy committed Aug 29, 2024
1 parent c07c8fc commit 8afa7e1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions dlt/destinations/impl/lancedb/lancedb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,13 @@ def run(self) -> None:
if (self._job_client.config.embedding_model_provider == "openai") and (
source_columns := get_columns_names_with_prop(self._load_table, VECTORIZE_HINT)
):
records: List[Dict[str, Any]]
for record in records:
for k, v in record.items():
if k in source_columns and not v:
record[k] = EMPTY_STRING_PLACEHOLDER
records = [
{
k: EMPTY_STRING_PLACEHOLDER if k in source_columns and v in ("", None) else v
for k, v in record.items()
}
for record in records
]

if self._load_table not in self._schema.dlt_tables():
for record in records:
Expand Down

0 comments on commit 8afa7e1

Please sign in to comment.