OmniSciDB
a5dc49c757
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
dtypes.py
Go to the documentation of this file.
1
"""
2
https://www.python.org/dev/peps/pep-0249/#type-objects
3
"""
4
import
datetime
5
import
time
6
from
heavydb.common.ttypes
import
TDatumType
7
8
T = TDatumType
9
10
11
class
DataType
:
12
def
__init__
(self, matches):
13
self.
_matches
= set(matches)
14
15
def
__eq__
(self, other):
16
return
other
in
self.
_matches
17
18
def
__ne__
(self, other):
19
return
not
(self == other)
20
21
def
__hash__
(self):
22
return
hash(tuple(self.
_matches
))
23
24
25
Binary = memoryview
26
Date = datetime.date
27
Time = datetime.time
28
Timestamp = datetime.datetime
29
30
BINARY =
DataType
([])
31
STRING =
DataType
(
32
[
33
T.STR,
34
T.POINT,
35
T.MULTIPOINT,
36
T.LINESTRING,
37
T.MULTILINESTRING,
38
T.POLYGON,
39
T.MULTIPOLYGON,
40
T.GEOMETRY,
41
T.GEOGRAPHY,
42
]
43
)
44
NUMBER =
DataType
(
45
[
46
T.SMALLINT,
47
T.INT,
48
T.BIGINT,
49
T.FLOAT,
50
T.DECIMAL,
51
T.DOUBLE,
52
T.BOOL,
53
T.TINYINT,
54
]
55
)
56
DATETIME =
DataType
([T.DATE, T.TIME, T.TIMESTAMP])
57
ROWID =
DataType
([])
58
59
60
def
DateFromTicks
(ticks):
61
return
Date
(*time.localtime(ticks)[:3])
62
63
64
def
TimeFromTicks
(ticks):
65
return
Time
(*time.localtime(ticks)[3:6])
66
67
68
def
TimestampFromTicks
(ticks):
69
return
Timestamp
(*time.localtime(ticks)[:6])
heavydb.dtypes.DataType.__init__
def __init__
Definition:
dtypes.py:12
heavydb.common.ttypes
Definition:
ttypes.py:1
heavydb.dtypes.Date
Date
Definition:
dtypes.py:26
heavydb.dtypes.DataType
Definition:
dtypes.py:11
heavydb.dtypes.DateFromTicks
def DateFromTicks
Definition:
dtypes.py:60
heavydb.dtypes.DataType.__ne__
def __ne__
Definition:
dtypes.py:18
heavydb.dtypes.TimeFromTicks
def TimeFromTicks
Definition:
dtypes.py:64
heavydb.dtypes.TimestampFromTicks
def TimestampFromTicks
Definition:
dtypes.py:68
heavydb.dtypes.DataType._matches
_matches
Definition:
dtypes.py:13
heavydb.dtypes.Time
Time
Definition:
dtypes.py:27
Timestamp
Definition:
heavydbTypes.h:698
heavydb.dtypes.DataType.__hash__
def __hash__
Definition:
dtypes.py:21
heavydb.dtypes.DataType.__eq__
def __eq__
Definition:
dtypes.py:15
python
heavydb
dtypes.py
Generated on Tue Aug 27 2024 00:12:40 for OmniSciDB by
1.8.5