Skip to content

Commit 417a862

Browse files
committed
rename
1 parent 6156a6d commit 417a862

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/databricks/labs/lsql/backends.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def fetch(self, sql: str, *, catalog: str | None = None, schema: str | None = No
201201
return self._sql.fetch_all(sql, catalog=catalog, schema=schema)
202202

203203

204-
class CommandContextBackend(ExecutionBackend):
204+
class CommandExecutionBackend(ExecutionBackend):
205205
def __init__(self, ws: WorkspaceClient, cluster_id, *, max_records_per_batch: int = 1000):
206206
self._sql = CommandExecutor(ws.clusters, ws.command_execution, lambda: cluster_id, language=Language.SQL)
207207
debug_truncate_bytes = ws.config.debug_truncate_bytes

tests/unit/test_command_execution_backend.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ResultType,
1414
)
1515

16-
from databricks.labs.lsql.backends import CommandContextBackend
16+
from databricks.labs.lsql.backends import CommandExecutionBackend
1717

1818

1919
@dataclass
@@ -46,9 +46,9 @@ def test_command_context_backend_execute_happy():
4646
)
4747
)
4848

49-
ccb = CommandContextBackend(ws, "abc")
49+
ceb = CommandExecutionBackend(ws, "abc")
5050

51-
ccb.execute("CREATE TABLE foo")
51+
ceb.execute("CREATE TABLE foo")
5252

5353
ws.command_execution.execute.assert_called_with(
5454
cluster_id="abc", language=Language.SQL, context_id="abc", command="CREATE TABLE foo"
@@ -66,9 +66,9 @@ def test_command_context_backend_with_overrides():
6666
)
6767
)
6868

69-
ccb = CommandContextBackend(ws, "abc")
69+
ceb = CommandExecutionBackend(ws, "abc")
7070

71-
ccb.execute("CREATE TABLE foo", catalog="foo", schema="bar")
71+
ceb.execute("CREATE TABLE foo", catalog="foo", schema="bar")
7272

7373
ws.command_execution.execute.assert_has_calls(
7474
[
@@ -95,9 +95,9 @@ def test_command_context_backend_fetch_happy():
9595
)
9696
)
9797

98-
ccb = CommandContextBackend(ws, "abc")
98+
ceb = CommandExecutionBackend(ws, "abc")
9999

100-
result = list(ccb.fetch("SELECT id FROM range(3)"))
100+
result = list(ceb.fetch("SELECT id FROM range(3)"))
101101

102102
assert [["1"], ["2"], ["3"]] == result
103103

@@ -113,8 +113,8 @@ def test_command_context_backend_save_table_overwrite_empty_table():
113113
)
114114
)
115115

116-
ccb = CommandContextBackend(ws, "abc")
117-
ccb.save_table("a.b.c", [Baz("1")], Baz, mode="overwrite")
116+
ceb = CommandExecutionBackend(ws, "abc")
117+
ceb.save_table("a.b.c", [Baz("1")], Baz, mode="overwrite")
118118

119119
ws.command_execution.execute.assert_has_calls(
120120
[
@@ -151,9 +151,9 @@ def test_command_context_backend_save_table_empty_records():
151151
)
152152
)
153153

154-
ccb = CommandContextBackend(ws, "abc")
154+
ceb = CommandExecutionBackend(ws, "abc")
155155

156-
ccb.save_table("a.b.c", [], Bar)
156+
ceb.save_table("a.b.c", [], Bar)
157157

158158
ws.command_execution.execute.assert_called_with(
159159
cluster_id="abc",
@@ -175,9 +175,9 @@ def test_command_context_backend_save_table_two_records():
175175
)
176176
)
177177

178-
ccb = CommandContextBackend(ws, "abc")
178+
ceb = CommandExecutionBackend(ws, "abc")
179179

180-
ccb.save_table("a.b.c", [Foo("aaa", True), Foo("bbb", False)], Foo)
180+
ceb.save_table("a.b.c", [Foo("aaa", True), Foo("bbb", False)], Foo)
181181

182182
ws.command_execution.execute.assert_has_calls(
183183
[
@@ -208,9 +208,9 @@ def test_command_context_backend_save_table_in_batches_of_two(mocker):
208208
)
209209
)
210210

211-
ccb = CommandContextBackend(ws, "abc", max_records_per_batch=2)
211+
ceb = CommandExecutionBackend(ws, "abc", max_records_per_batch=2)
212212

213-
ccb.save_table("a.b.c", [Foo("aaa", True), Foo("bbb", False), Foo("ccc", True)], Foo)
213+
ceb.save_table("a.b.c", [Foo("aaa", True), Foo("bbb", False), Foo("ccc", True)], Foo)
214214

215215
ws.command_execution.execute.assert_has_calls(
216216
[

0 commit comments

Comments
 (0)