Skip to content

Commit

Permalink
chore: imports
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Jan 13, 2023
1 parent e7123c6 commit 7fb555b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion databank/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import json
from datetime import datetime
from typing import Any, Mapping, Union

from sqlalchemy import text
from sqlalchemy.sql.elements import TextClause
from sqlalchemy.engine.interfaces import Dialect
from sqlalchemy.sql.elements import TextClause

# supported types for a row value
Value = Union[str, int, float, bool, tuple, datetime]
Expand Down
8 changes: 7 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from datetime import datetime

from databank.utils import serialize_param
from databank.utils import compile_sql, serialize_param


def test_serialize_param():
Expand All @@ -13,3 +13,9 @@ def test_serialize_param():
assert serialize_param([0]) == json.dumps([0])
assert serialize_param(datetime(1970, 1, 1)) == datetime(1970, 1, 1)
assert serialize_param((0, 1, 2)) == (0, 1, 2)


def test_compile_sql():
expected = "SELECT * FROM foo WHERE bar = 1;"
actual = compile_sql("SELECT * FROM foo WHERE bar = :bar;", params={"bar": 1})
assert actual == expected

0 comments on commit 7fb555b

Please sign in to comment.