13
13
ResultType ,
14
14
)
15
15
16
- from databricks .labs .lsql .backends import CommandContextBackend
16
+ from databricks .labs .lsql .backends import CommandExecutionBackend
17
17
18
18
19
19
@dataclass
@@ -46,9 +46,9 @@ def test_command_context_backend_execute_happy():
46
46
)
47
47
)
48
48
49
- ccb = CommandContextBackend (ws , "abc" )
49
+ ceb = CommandExecutionBackend (ws , "abc" )
50
50
51
- ccb .execute ("CREATE TABLE foo" )
51
+ ceb .execute ("CREATE TABLE foo" )
52
52
53
53
ws .command_execution .execute .assert_called_with (
54
54
cluster_id = "abc" , language = Language .SQL , context_id = "abc" , command = "CREATE TABLE foo"
@@ -66,9 +66,9 @@ def test_command_context_backend_with_overrides():
66
66
)
67
67
)
68
68
69
- ccb = CommandContextBackend (ws , "abc" )
69
+ ceb = CommandExecutionBackend (ws , "abc" )
70
70
71
- ccb .execute ("CREATE TABLE foo" , catalog = "foo" , schema = "bar" )
71
+ ceb .execute ("CREATE TABLE foo" , catalog = "foo" , schema = "bar" )
72
72
73
73
ws .command_execution .execute .assert_has_calls (
74
74
[
@@ -95,9 +95,9 @@ def test_command_context_backend_fetch_happy():
95
95
)
96
96
)
97
97
98
- ccb = CommandContextBackend (ws , "abc" )
98
+ ceb = CommandExecutionBackend (ws , "abc" )
99
99
100
- result = list (ccb .fetch ("SELECT id FROM range(3)" ))
100
+ result = list (ceb .fetch ("SELECT id FROM range(3)" ))
101
101
102
102
assert [["1" ], ["2" ], ["3" ]] == result
103
103
@@ -113,8 +113,8 @@ def test_command_context_backend_save_table_overwrite_empty_table():
113
113
)
114
114
)
115
115
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" )
118
118
119
119
ws .command_execution .execute .assert_has_calls (
120
120
[
@@ -151,9 +151,9 @@ def test_command_context_backend_save_table_empty_records():
151
151
)
152
152
)
153
153
154
- ccb = CommandContextBackend (ws , "abc" )
154
+ ceb = CommandExecutionBackend (ws , "abc" )
155
155
156
- ccb .save_table ("a.b.c" , [], Bar )
156
+ ceb .save_table ("a.b.c" , [], Bar )
157
157
158
158
ws .command_execution .execute .assert_called_with (
159
159
cluster_id = "abc" ,
@@ -175,9 +175,9 @@ def test_command_context_backend_save_table_two_records():
175
175
)
176
176
)
177
177
178
- ccb = CommandContextBackend (ws , "abc" )
178
+ ceb = CommandExecutionBackend (ws , "abc" )
179
179
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 )
181
181
182
182
ws .command_execution .execute .assert_has_calls (
183
183
[
@@ -208,9 +208,9 @@ def test_command_context_backend_save_table_in_batches_of_two(mocker):
208
208
)
209
209
)
210
210
211
- ccb = CommandContextBackend (ws , "abc" , max_records_per_batch = 2 )
211
+ ceb = CommandExecutionBackend (ws , "abc" , max_records_per_batch = 2 )
212
212
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 )
214
214
215
215
ws .command_execution .execute .assert_has_calls (
216
216
[
0 commit comments