From 8afa7e1f400a06d412c890ea24702688b7f37e5e Mon Sep 17 00:00:00 2001 From: Marcel Coetzee Date: Thu, 29 Aug 2024 22:50:20 +0200 Subject: [PATCH] Simplify null string handling Signed-off-by: Marcel Coetzee --- dlt/destinations/impl/lancedb/lancedb_client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlt/destinations/impl/lancedb/lancedb_client.py b/dlt/destinations/impl/lancedb/lancedb_client.py index f28fdac78d..9b240d58cb 100644 --- a/dlt/destinations/impl/lancedb/lancedb_client.py +++ b/dlt/destinations/impl/lancedb/lancedb_client.py @@ -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: