Skip to content

Commit

Permalink
support sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Jul 21, 2022
1 parent 8bda88f commit 3d8cd90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 7 additions & 0 deletions tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def physical_dataset():

example_database = get_example_database()
engine = example_database.get_sqla_engine()
# sqlite can only execute one statement at a time
engine.execute(
"""
CREATE TABLE IF NOT EXISTS physical_dataset(
Expand All @@ -268,6 +269,10 @@ def physical_dataset():
col4 VARCHAR(255),
col5 VARCHAR(255)
);
"""
)
engine.execute(
"""
INSERT INTO physical_dataset values
(0, 'a', 1.0, NULL, '2000-01-01 00:00:00'),
(1, 'b', 1.1, NULL, '2000-01-02 00:00:00'),
Expand All @@ -293,6 +298,8 @@ def physical_dataset():
TableColumn(column_name="col5", type="VARCHAR(255)", table=dataset)
SqlMetric(metric_name="count", expression="count(*)", table=dataset)
db.session.merge(dataset)
if example_database.backend == "sqlite":
db.session.commit()

yield dataset

Expand Down
9 changes: 0 additions & 9 deletions tests/integration_tests/datasource_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,6 @@ def test_get_samples(test_client, login_as_admin, virtual_dataset):
"""
Dataset API: Test get dataset samples
"""
if backend() == "sqlite":
return

# 1. should cache data
uri = (
f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table"
Expand Down Expand Up @@ -475,9 +472,6 @@ def test_get_samples(test_client, login_as_admin, virtual_dataset):


def test_get_samples_with_incorrect_cc(test_client, login_as_admin, virtual_dataset):
if backend() == "sqlite":
return

TableColumn(
column_name="DUMMY CC",
type="VARCHAR(255)",
Expand All @@ -499,9 +493,6 @@ def test_get_samples_with_incorrect_cc(test_client, login_as_admin, virtual_data


def test_get_samples_on_physical_dataset(test_client, login_as_admin, physical_dataset):
if backend() == "sqlite":
return

uri = (
f"/datasource/samples?datasource_id={physical_dataset.id}&datasource_type=table"
)
Expand Down

0 comments on commit 3d8cd90

Please sign in to comment.