Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def _prepare_schema(self):
- The DDL file is expected to be located in the `resources.ddl` directory corresponding to the TPC benchmark variant.
"""
self.engine.create_schema_if_not_exists(drop_before_create=True)
self.engine.create_external_location(self.input_parquet_folder_uri)

engine_class_name = self.engine.__class__.__name__.lower()
parent_class_name = self.engine.__class__.__bases__[0].__name__.lower()
Expand Down
1 change: 1 addition & 0 deletions src/lakebench/benchmarks/elt_bench/elt_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _prepare_schema(self, tables: list[str]):


self.engine.create_schema_if_not_exists(drop_before_create=True)
self.engine.create_external_location(self.input_parquet_folder_uri)

engine_class_name = self.engine.__class__.__name__.lower()
parent_class_name = self.engine.__class__.__bases__[0].__name__.lower()
Expand Down
12 changes: 10 additions & 2 deletions src/lakebench/engines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _detect_runtime(self) -> str:

# Check for Microsoft Fabric or Synapse
try:
notebookutils = get_ipython().user_ns.get("notebookutils")
notebookutils = get_ipython().user_ns.get("notebookutils") # noqa: F821
if notebookutils and hasattr(notebookutils, 'runtime'):
if hasattr(notebookutils.runtime, 'context'):
context = notebookutils.runtime.context
Expand All @@ -122,7 +122,7 @@ def _detect_runtime(self) -> str:
if 'DATABRICKS_RUNTIME_VERSION' in os.environ:
return "databricks"
try:
dbutils = get_ipython().user_ns.get("dbutils")
dbutils = get_ipython().user_ns.get("dbutils") # noqa: F821
if dbutils:
return "databricks"
except:
Expand Down Expand Up @@ -200,6 +200,14 @@ def get_job_cost(self, duration_ms: int) -> Optional[Decimal]:
job_cost = Decimal(self.cost_per_hour) * (Decimal(duration_ms) / Decimal(3600000)) # Convert ms to hours
return job_cost.quantize(Decimal('0.0000000000')) # Ensure precision matches DECIMAL(18,10)


def create_external_location(self, location_uri: str):
"""
Supports engines that need to create external locations for data access.
By default, this is a no-op and is only overridden by subclasses as needed.
"""
pass

def create_schema_if_not_exists(self, drop_before_create: bool = True):
if drop_before_create:
if self.fs.exists(self.schema_or_working_directory_uri):
Expand Down