Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit bcb7f3e

Browse files
authored
Merge pull request #12 from datafold/dev
Dev
2 parents 406de9a + 50b300c commit bcb7f3e

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

sqeleton/abcs/database_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class TimestampTZ(TemporalType):
4242
class Datetime(TemporalType):
4343
pass
4444

45+
class Date(TemporalType):
46+
pass
47+
4548

4649
@dataclass
4750
class NumericType(ColType):

sqeleton/databases/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ def query(self, sql_ast: Union[Expr, Generator], res_type: type = None):
343343
sys.exit(1)
344344

345345
res = self._query(sql_code)
346-
if res_type is int:
346+
if res_type is list:
347+
return list(res)
348+
elif res_type is int:
347349
if not res:
348350
raise ValueError("Query returned 0 rows, expected 1")
349351
row = _one(res)

sqeleton/databases/mysql.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
FractionalType,
1010
ColType_UUID,
1111
Boolean,
12+
Date,
1213
)
1314
from ..abcs.mixins import (
1415
AbstractMixin_MD5,
@@ -62,17 +63,24 @@ class Dialect(BaseDialect, Mixin_Schema):
6263
# Dates
6364
"datetime": Datetime,
6465
"timestamp": Timestamp,
66+
"date": Date,
6567
# Numbers
6668
"double": Float,
6769
"float": Float,
6870
"decimal": Decimal,
6971
"int": Integer,
7072
"bigint": Integer,
73+
"smallint": Integer,
74+
"tinyint": Integer,
7175
# Text
7276
"varchar": Text,
7377
"char": Text,
7478
"varbinary": Text,
7579
"binary": Text,
80+
"text": Text,
81+
"mediumtext": Text,
82+
"longtext": Text,
83+
"tinytext": Text,
7684
# Boolean
7785
"boolean": Boolean,
7886
}

sqeleton/databases/postgresql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Text,
1010
FractionalType,
1111
Boolean,
12+
Date,
1213
)
1314
from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue
1415
from .base import BaseDialect, ThreadedDatabase, import_helper, ConnectError, Mixin_Schema
@@ -60,6 +61,7 @@ class PostgresqlDialect(BaseDialect, Mixin_Schema):
6061
"timestamp with time zone": TimestampTZ,
6162
"timestamp without time zone": Timestamp,
6263
"timestamp": Timestamp,
64+
"date": Date,
6365
# Numbers
6466
"double precision": Float,
6567
"real": Float,

0 commit comments

Comments
 (0)