Skip to content

Commit bf52c91

Browse files
authored
Remove references to UCX (#56)
## Changes Remove references to UCX for fixture names
1 parent 512c014 commit bf52c91

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

src/databricks/labs/pytester/fixtures/catalog.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def create( # pylint: disable=too-many-locals,too-many-arguments,too-many-state
118118
schema = make_schema(catalog_name=catalog_name)
119119
catalog_name = schema.catalog_name
120120
schema_name = schema.name
121-
if name is None:
122-
name = f"ucx_T{make_random(4)}".lower()
121+
name = name or f"dummy_t{make_random(4).lower()}"
123122
table_type: TableType | None = None
124123
data_source_format = None
125124
storage_location = None
@@ -140,7 +139,7 @@ def create( # pylint: disable=too-many-locals,too-many-arguments,too-many-state
140139
table_type = TableType.EXTERNAL # pylint: disable=redefined-variable-type
141140
data_source_format = DataSourceFormat.JSON
142141
# DBFS locations are not purged; no suffix necessary.
143-
storage_location = f"dbfs:/tmp/ucx_test_{make_random(4)}"
142+
storage_location = f"dbfs:/tmp/{name}"
144143
if columns is None:
145144
select = "*"
146145
else:
@@ -264,8 +263,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table):
264263
"""
265264

266265
def create(*, catalog_name: str = "hive_metastore", name: str | None = None) -> SchemaInfo:
267-
if name is None:
268-
name = f"dummy_S{make_random(4)}".lower()
266+
name = name or f"dummy_s{make_random(4)}".lower()
269267
full_name = f"{catalog_name}.{name}".lower()
270268
sql_backend.execute(f"CREATE SCHEMA {full_name} WITH DBPROPERTIES (RemoveAfter={watchdog_remove_after})")
271269
schema_info = SchemaInfo(catalog_name=catalog_name, name=name, full_name=full_name)
@@ -301,7 +299,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table):
301299
"""
302300

303301
def create(*, name: str | None = None) -> CatalogInfo:
304-
name = name or f"dummy_C{make_random(4)}".lower()
302+
name = name or f"dummy_c{make_random(4)}".lower()
305303
catalog_info = ws.catalogs.create(name=name, properties={"RemoveAfter": watchdog_remove_after})
306304
if isinstance(catalog_info, Mock):
307305
catalog_info.name = name
@@ -353,8 +351,7 @@ def create(
353351
catalog_name = schema.catalog_name
354352
schema_name = schema.name
355353

356-
if name is None:
357-
name = f"ucx_t{make_random(4).lower()}"
354+
name = name or f"dummy_f{make_random(4)}".lower()
358355

359356
# Note: the Watchdog does not explicitly scan for functions; they are purged along with their parent schema.
360357
# As such the function can't be marked (and doesn't need to be if the schema as marked) for purge protection.

src/databricks/labs/pytester/fixtures/redash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def create(sql_query: str | None = None, **kwargs) -> LegacyQuery:
5454
query_name = f"dummy_query_Q{make_random(4)}"
5555
query = ws.queries_legacy.create(
5656
name=query_name,
57-
description="TEST QUERY FOR UCX",
57+
description="Test query",
5858
query=sql_query,
5959
tags=tags,
6060
)

tests/unit/fixtures/test_catalog.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ def test_make_table_no_args():
1212
assert table_info == TableInfo(
1313
catalog_name='hive_metastore',
1414
schema_name='dummy_srandom',
15-
name='ucx_trandom',
15+
name='dummy_trandom',
1616
table_type=TableType.MANAGED,
1717
data_source_format=DataSourceFormat.DELTA,
18-
full_name='hive_metastore.dummy_srandom.ucx_trandom',
19-
storage_location='dbfs:/user/hive/warehouse/dummy_srandom/ucx_trandom',
18+
full_name='hive_metastore.dummy_srandom.dummy_trandom',
19+
storage_location='dbfs:/user/hive/warehouse/dummy_srandom/dummy_trandom',
2020
properties={'RemoveAfter': '2024091313'},
2121
)
2222

2323
assert ctx['sql_backend'].queries == [
2424
'CREATE SCHEMA hive_metastore.dummy_srandom WITH DBPROPERTIES (RemoveAfter=2024091313)',
25-
"CREATE TABLE hive_metastore.dummy_srandom.ucx_trandom (id INT, value STRING) TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
26-
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.ucx_trandom',
25+
"CREATE TABLE hive_metastore.dummy_srandom.dummy_trandom (id INT, value STRING) TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
26+
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.dummy_trandom',
2727
'DROP SCHEMA IF EXISTS hive_metastore.dummy_srandom CASCADE',
2828
]
2929

@@ -34,18 +34,18 @@ def test_make_view():
3434
assert table_info == TableInfo(
3535
catalog_name='hive_metastore',
3636
schema_name='dummy_srandom',
37-
name='ucx_trandom',
37+
name='dummy_trandom',
3838
table_type=TableType.VIEW,
39-
full_name='hive_metastore.dummy_srandom.ucx_trandom',
39+
full_name='hive_metastore.dummy_srandom.dummy_trandom',
4040
properties={'RemoveAfter': '2024091313'},
4141
view_definition='SELECT 1',
4242
)
4343

4444
assert ctx['sql_backend'].queries == [
4545
'CREATE SCHEMA hive_metastore.dummy_srandom WITH DBPROPERTIES (RemoveAfter=2024091313)',
46-
"CREATE VIEW hive_metastore.dummy_srandom.ucx_trandom AS SELECT 1",
47-
"ALTER VIEW hive_metastore.dummy_srandom.ucx_trandom SET TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
48-
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.ucx_trandom',
46+
"CREATE VIEW hive_metastore.dummy_srandom.dummy_trandom AS SELECT 1",
47+
"ALTER VIEW hive_metastore.dummy_srandom.dummy_trandom SET TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
48+
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.dummy_trandom',
4949
'DROP SCHEMA IF EXISTS hive_metastore.dummy_srandom CASCADE',
5050
]
5151

@@ -56,27 +56,27 @@ def test_make_external_table():
5656
assert table_info == TableInfo(
5757
catalog_name='hive_metastore',
5858
schema_name='dummy_srandom',
59-
name='ucx_trandom',
59+
name='dummy_trandom',
6060
table_type=TableType.EXTERNAL,
6161
data_source_format=DataSourceFormat.JSON,
62-
full_name='hive_metastore.dummy_srandom.ucx_trandom',
63-
storage_location='dbfs:/tmp/ucx_test_RANDOM',
62+
full_name='hive_metastore.dummy_srandom.dummy_trandom',
63+
storage_location='dbfs:/tmp/dummy_trandom',
6464
properties={'RemoveAfter': '2024091313'},
6565
)
6666

6767
ctx['log_workspace_link'].assert_called_with(
68-
'hive_metastore.dummy_srandom.ucx_trandom schema',
69-
'explore/data/hive_metastore/dummy_srandom/ucx_trandom',
68+
'hive_metastore.dummy_srandom.dummy_trandom schema',
69+
'explore/data/hive_metastore/dummy_srandom/dummy_trandom',
7070
)
7171

7272
assert ctx['sql_backend'].queries == [
7373
'CREATE SCHEMA hive_metastore.dummy_srandom WITH DBPROPERTIES (RemoveAfter=2024091313)',
74-
'CREATE TABLE hive_metastore.dummy_srandom.ucx_trandom USING json location '
75-
"'dbfs:/tmp/ucx_test_RANDOM' as SELECT CAST(calories_burnt AS INT) AS `id`, "
74+
'CREATE TABLE hive_metastore.dummy_srandom.dummy_trandom USING json location '
75+
"'dbfs:/tmp/dummy_trandom' as SELECT CAST(calories_burnt AS INT) AS `id`, "
7676
'CAST(device_id AS STRING) AS `value` FROM '
7777
'JSON.`dbfs:/databricks-datasets/iot-stream/data-device`',
78-
"ALTER TABLE hive_metastore.dummy_srandom.ucx_trandom SET TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
79-
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.ucx_trandom',
78+
"ALTER TABLE hive_metastore.dummy_srandom.dummy_trandom SET TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
79+
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.dummy_trandom',
8080
'DROP SCHEMA IF EXISTS hive_metastore.dummy_srandom CASCADE',
8181
]
8282

@@ -87,18 +87,18 @@ def test_make_table_custom_schema():
8787
assert table_info == TableInfo(
8888
catalog_name='hive_metastore',
8989
schema_name='dummy_srandom',
90-
name='ucx_trandom',
90+
name='dummy_trandom',
9191
table_type=TableType.MANAGED,
9292
data_source_format=DataSourceFormat.DELTA,
93-
full_name='hive_metastore.dummy_srandom.ucx_trandom',
94-
storage_location='dbfs:/user/hive/warehouse/dummy_srandom/ucx_trandom',
93+
full_name='hive_metastore.dummy_srandom.dummy_trandom',
94+
storage_location='dbfs:/user/hive/warehouse/dummy_srandom/dummy_trandom',
9595
properties={'RemoveAfter': '2024091313'},
9696
)
9797

9898
assert ctx['sql_backend'].queries == [
9999
'CREATE SCHEMA hive_metastore.dummy_srandom WITH DBPROPERTIES (RemoveAfter=2024091313)',
100-
"CREATE TABLE hive_metastore.dummy_srandom.ucx_trandom (`a` INT, `b` STRING) TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
101-
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.ucx_trandom',
100+
"CREATE TABLE hive_metastore.dummy_srandom.dummy_trandom (`a` INT, `b` STRING) TBLPROPERTIES ( 'RemoveAfter' = '2024091313' )",
101+
'DROP TABLE IF EXISTS hive_metastore.dummy_srandom.dummy_trandom',
102102
'DROP SCHEMA IF EXISTS hive_metastore.dummy_srandom CASCADE',
103103
]
104104

@@ -120,15 +120,15 @@ def test_make_udf():
120120
assert fn_info == FunctionInfo(
121121
catalog_name='hive_metastore',
122122
schema_name='dummy_srandom',
123-
name='ucx_trandom',
124-
full_name='hive_metastore.dummy_srandom.ucx_trandom',
123+
name='dummy_frandom',
124+
full_name='hive_metastore.dummy_srandom.dummy_frandom',
125125
)
126126

127127
assert ctx['sql_backend'].queries == [
128128
'CREATE SCHEMA hive_metastore.dummy_srandom WITH DBPROPERTIES (RemoveAfter=2024091313)',
129-
'CREATE FUNCTION hive_metastore.dummy_srandom.ucx_trandom(x INT) RETURNS '
129+
'CREATE FUNCTION hive_metastore.dummy_srandom.dummy_frandom(x INT) RETURNS '
130130
'FLOAT CONTAINS SQL DETERMINISTIC RETURN 0;',
131-
'DROP FUNCTION IF EXISTS hive_metastore.dummy_srandom.ucx_trandom',
131+
'DROP FUNCTION IF EXISTS hive_metastore.dummy_srandom.dummy_frandom',
132132
'DROP SCHEMA IF EXISTS hive_metastore.dummy_srandom CASCADE',
133133
]
134134

0 commit comments

Comments
 (0)