Skip to content

Commit 42da4fa

Browse files
authored
fix: databricks delta table name edge cases (#484)
1 parent 46a2476 commit 42da4fa

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.19
2+
3+
* **Fix databricks delta table name edge cases**
4+
15
## 1.0.18
26

37
* **Enforce api key if SDK defaults to os env var**

unstructured_ingest/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.18" # pragma: no cover
1+
__version__ = "1.0.19" # pragma: no cover
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE elements (
1+
CREATE TABLE IF NOT EXISTS `elements` (
22
id STRING NOT NULL PRIMARY KEY,
33
record_id STRING NOT NULL,
44
element_id STRING NOT NULL,
@@ -7,4 +7,3 @@ CREATE TABLE elements (
77
type STRING,
88
metadata VARIANT
99
);
10-

unstructured_ingest/processes/connectors/databricks/volumes_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_cursor(self, **connect_kwargs) -> Generator[Any, None, None]:
136136
def get_table_columns(self) -> dict[str, str]:
137137
if self._columns is None:
138138
with self.get_cursor() as cursor:
139-
cursor.execute(f"SELECT * from {self.upload_config.table_name} LIMIT 1")
139+
cursor.execute(f"SELECT * from `{self.upload_config.table_name}` LIMIT 1")
140140
self._columns = {desc[0]: desc[1] for desc in cursor.description}
141141
return self._columns
142142

@@ -152,7 +152,7 @@ def delete_previous_content(self, file_data: FileData) -> None:
152152
)
153153
with self.get_cursor() as cursor:
154154
cursor.execute(
155-
f"DELETE FROM {self.upload_config.table_name} WHERE {RECORD_ID_LABEL} = '{file_data.identifier}'" # noqa: E501
155+
f"DELETE FROM `{self.upload_config.table_name}` WHERE {RECORD_ID_LABEL} = '{file_data.identifier}'" # noqa: E501
156156
)
157157
results = cursor.fetchall()
158158
deleted_rows = results[0][0]

0 commit comments

Comments
 (0)