Skip to content

Commit 228db8f

Browse files
Fix bug where we have not specified any properties
1 parent 54959f7 commit 228db8f

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Directories created during CI
2-
tests/end_to_end_tests/DREGS_data/
2+
tests/end_to_end_tests/DataRegistry_data/
33
tests/end_to_end_tests/dummy_dir/
44

55
# Byte-compiled / optimized / DLL files

src/dataregistry/query.py

+9
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def _parse_selected_columns(self, column_names):
157157
format. If they are in <column_name> format the column name must be
158158
unique through all tables in the database.
159159
160+
If column_names is None, return all tables.
161+
160162
Parameters
161163
----------
162164
column_names : list
@@ -167,6 +169,13 @@ def _parse_selected_columns(self, column_names):
167169
column_list = []
168170
is_orderable_list = []
169171

172+
# In the case where column_names is None, we want all tables.
173+
if column_names is None:
174+
for t in self._table_list:
175+
tables_required.add(t)
176+
177+
return tables_required, column_list, is_orderable_list
178+
170179
# Determine the column name and table it comes from
171180
for p in column_names:
172181

tests/end_to_end_tests/test_query.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
datareg = DataRegistry(root_dir="DataRegistry_data")
77

88

9+
def test_query_all():
10+
"""Test a query where no properties are chosen, i.e., 'return *"""
11+
results = datareg.Query.find_datasets()
12+
13+
assert results is not None
14+
15+
916
def test_query_dataset_cli():
10-
""" Test queries for the dataset table entered from the CLI script """
17+
"""Test queries for the dataset table entered from the CLI script"""
1118

1219
# Query 1: Make sure we find all datasets entered using the CLI
1320
f = datareg.Query.gen_filter("dataset.name", "==", "my_cli_dataset")
@@ -18,7 +25,7 @@ def test_query_dataset_cli():
1825

1926

2027
def test_query_dataset():
21-
""" Test queries for the dataset table """
28+
"""Test queries for the dataset table"""
2229

2330
# Query 1: Query on dataset name
2431
f = datareg.Query.gen_filter("dataset.name", "==", "bumped_dataset")
@@ -96,7 +103,7 @@ def test_query_dataset():
96103

97104

98105
def test_query_dataset_alias():
99-
""" Test queries of dataset alias table """
106+
"""Test queries of dataset alias table"""
100107

101108
# Query 1: Query on dataset alias
102109
f = datareg.Query.gen_filter("dataset_alias.alias", "==", "nice_dataset_name")
@@ -111,7 +118,7 @@ def test_query_dataset_alias():
111118

112119

113120
def test_query_execution():
114-
""" Test queries of execution table """
121+
"""Test queries of execution table"""
115122

116123
# Query 1: Find the dependencies of an execution
117124
f = datareg.Query.gen_filter("execution.name", "==", "pipeline_stage_3")

0 commit comments

Comments
 (0)