Skip to content
Merged

fixes #230

Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions bmsdna/lakeapi/core/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,21 @@ def get_execution_uri(self, meta_only: bool):
def file_exists(self):
if self.config.file_type in ["odbc", "sqlite"]:
return True # the uri is not really a file here
if self.config.file_type == "delta":
return self.get_execution_uri(meta_only=True).exists()
if not self.source_uri.exists():
return False
return True

def get_delta_table(self, schema_only: bool):
if self.config.file_type == "delta":
if self.source_uri.exists():
if self.file_exists():
try:
from bmsdna.lakeapi.utils.meta_cache import get_deltalake_meta

meta = get_deltalake_meta(
self.basic_config.default_engine == "polars", self.source_uri
self.basic_config.default_engine == "polars",
self.get_execution_uri(meta_only=True),
)
return meta
except FileNotFoundError:
Expand Down
5 changes: 4 additions & 1 deletion bmsdna/lakeapi/utils/meta_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def get_deltalake_meta(use_polars: bool, uri: SourceUri):
else:
if _global_duck_con is None:
_global_duck_con = duckdb.connect(":memory:")
_global_duck_meta_engine = DuckDBMetaEngine(_global_duck_con)
_global_duck_meta_engine = DuckDBMetaEngine(
_global_duck_con,
use_fsspec=os.getenv("DUCKDB_DELTA_USE_FSSPEC", "0") == "1",
)
ab_uri, ab_opts = uri.get_uri_options(flavor="original")
assert _global_duck_meta_engine is not None
meta_engine = _global_duck_meta_engine
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bmsdna-lakeapi"
version = "0.27.2"
version = "0.27.3"
description = ""
authors = [{ name = "DWH Team", email = "[email protected]" }]
dependencies = [
Expand Down
Loading