forked from snowflakedb/snowflake-sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_types.py
49 lines (32 loc) · 1008 Bytes
/
custom_types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved.
#
import sqlalchemy.types as sqltypes
TEXT = sqltypes.VARCHAR
CHARACTER = sqltypes.CHAR
DEC = sqltypes.DECIMAL
DOUBLE = sqltypes.FLOAT
FIXED = sqltypes.DECIMAL
NUMBER = sqltypes.DECIMAL
BYTEINT = sqltypes.SMALLINT
STRING = sqltypes.VARCHAR
TINYINT = sqltypes.SMALLINT
VARBINARY = sqltypes.BINARY
class SnowflakeType(sqltypes.TypeEngine):
def _default_dialect(self):
# Get around circular import
return __import__('snowflake.sqlalchemy').sqlalchemy.dialect()
class VARIANT(SnowflakeType):
__visit_name__ = 'VARIANT'
class OBJECT(SnowflakeType):
__visit_name__ = 'OBJECT'
class ARRAY(SnowflakeType):
__visit_name__ = 'ARRAY'
class TIMESTAMP_TZ(SnowflakeType):
__visit_name__ = 'TIMESTAMP_TZ'
class TIMESTAMP_LTZ(SnowflakeType):
__visit_name__ = 'TIMESTAMP_LTZ'
class TIMESTAMP_NTZ(SnowflakeType):
__visit_name__ = 'TIMESTAMP_NTZ'