Skip to content

Commit beff612

Browse files
committed
Do some minor coverage pumping (add a test for the SQLAlchemy dburl conversion), remove the CSV FDW from coverage (is tested inside of the engine)
1 parent bc8b6d5 commit beff612

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.coveragerc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[report]
22
# Tested inside of the actual engine
3-
omit = splitgraph/core/fdw_checkout.py,splitgraph/core/server.py
3+
omit = splitgraph/core/fdw_checkout.py,splitgraph/core/server.py,splitgraph/ingestion/csv/fdw.py
44

55
# Regexes for lines to exclude from consideration
66
exclude_lines =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from unittest.mock import Mock
2+
3+
from splitgraph.ingestion.snowflake import SnowflakeDataSource
4+
5+
6+
def test_snowflake_data_source_dburl_conversion():
7+
source = SnowflakeDataSource(
8+
Mock(),
9+
credentials={
10+
"username": "username",
11+
"password": "password",
12+
"account": "abcdef.eu-west-1.aws",
13+
},
14+
params={
15+
"database": "SOME_DB",
16+
"schema": "TPCH_SF100",
17+
"warehouse": "my_warehouse",
18+
"role": "role",
19+
},
20+
)
21+
22+
assert source.get_server_options() == {
23+
"db_url": "snowflake://username:[email protected]/SOME_DB/TPCH_SF100warehouse=my_warehouse&role=role",
24+
"wrapper": "multicorn.sqlalchemyfdw.SqlAlchemyFdw",
25+
}
26+
27+
source = SnowflakeDataSource(
28+
Mock(),
29+
credentials={
30+
"username": "username",
31+
"password": "password",
32+
"account": "abcdef.eu-west-1.aws",
33+
},
34+
params={
35+
"database": "SOME_DB",
36+
"tables": {
37+
"test_table": {
38+
"schema": {"col_1": "int", "col_2": "varchar"},
39+
"options": {"subquery": "SELECT col_1, col_2 FROM other_table"},
40+
}
41+
},
42+
},
43+
)
44+
45+
assert source.get_table_options("test_table") == {
46+
"subquery": "SELECT col_1, col_2 FROM other_table",
47+
"tablename": "test_table",
48+
}

0 commit comments

Comments
 (0)