e6data-python-connector 2.0.0__py3-none-any.whl → 2.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ from builtins import str
18
18
  from future.utils import with_metaclass
19
19
  from past.builtins import basestring
20
20
 
21
- from e6xdb.exceptions import ProgrammingError
21
+ from e6data_python_connector.exceptions import ProgrammingError
22
22
 
23
23
  _logger = logging.getLogger(__name__)
24
24
 
@@ -7,8 +7,19 @@ from thrift.protocol import TBinaryProtocol
7
7
  from thrift.transport import TTransport
8
8
 
9
9
  from e6data_python_connector.e6x_vector.ttypes import Chunk, Vector, VectorType
10
- from e6xdb.constants import ZONE
11
- from e6xdb.date_time_utils import floor_div, floor_mod
10
+ from e6data_python_connector.constants import ZONE
11
+ from e6data_python_connector.date_time_utils import floor_div, floor_mod, get_zone
12
+
13
+ try:
14
+ from thrift.protocol import fastbinary
15
+ except ImportError:
16
+ raise Exception(
17
+ """
18
+ Failed to import fastbinary.
19
+ Did you install system dependencies?
20
+ Please verify https://github.com/e6x-labs/e6data-python-connector#dependencies
21
+ """
22
+ )
12
23
 
13
24
  _logger = logging.getLogger(__name__)
14
25
 
@@ -195,13 +206,16 @@ def get_column_from_chunk(vector: Vector) -> list:
195
206
  if vector.nullSet[row]:
196
207
  value_array.append(None)
197
208
  continue
198
- value_array.append(vector.data.int64Data.data[row] if not vector.isConstantVector else vector.data.numericConstantData.data)
209
+ value_array.append(vector.data.int64Data.data[
210
+ row] if not vector.isConstantVector else vector.data.numericConstantData.data)
199
211
  elif d_type == VectorType.DATE:
200
212
  for row in range(vector.size):
201
213
  if vector.nullSet[row]:
202
214
  value_array.append(None)
203
215
  continue
204
- epoch_seconds = floor_div(vector.data.dateData.data[row] if not vector.isConstantVector else vector.data.dateConstantData.data, 1000_000)
216
+ epoch_seconds = floor_div(vector.data.dateData.data[
217
+ row] if not vector.isConstantVector else vector.data.dateConstantData.data,
218
+ 1000_000)
205
219
  zone_offset = pytz.timezone('UTC') if vector.zoneOffset == 'Z' else pytz.timezone(vector.zoneOffset)
206
220
  date = datetime.fromtimestamp(epoch_seconds, zone_offset)
207
221
  value_array.append(date.strftime("%Y-%m-%d"))
@@ -213,7 +227,7 @@ def get_column_from_chunk(vector: Vector) -> list:
213
227
  epoch_micros = vector.data.timeData.data[row] if not vector.isConstantVector else vector.data.timeConstantData.data
214
228
  epoch_seconds = floor_div(epoch_micros, 1000_000)
215
229
  micros_of_the_day = floor_mod(epoch_micros, 1000_000)
216
- zone_offset = pytz.timezone('UTC') if vector.zoneOffset == 'Z' else pytz.timezone(vector.zoneOffset)
230
+ zone_offset = pytz.timezone('UTC') if vector.zoneOffset == 'Z' else pytz.timezone(get_zone(vector.zoneOffset))
217
231
  date_time = datetime.fromtimestamp(epoch_seconds, zone_offset)
218
232
  date_time = date_time + timedelta(microseconds=micros_of_the_day)
219
233
  value_array.append(date_time.strftime("%Y-%m-%d %H:%M:%S"))
@@ -222,37 +236,43 @@ def get_column_from_chunk(vector: Vector) -> list:
222
236
  if vector.nullSet[row]:
223
237
  value_array.append(None)
224
238
  continue
225
- value_array.append(vector.data.varcharData.data[row] if not vector.isConstantVector else vector.data.varcharConstantData.data)
239
+ value_array.append(vector.data.varcharData.data[
240
+ row] if not vector.isConstantVector else vector.data.varcharConstantData.data)
226
241
  elif d_type == VectorType.DOUBLE:
227
242
  for row in range(vector.size):
228
243
  if vector.nullSet[row]:
229
244
  value_array.append(None)
230
245
  continue
231
- value_array.append(vector.data.float64Data.data[row] if not vector.isConstantVector else vector.data.numericDecimalConstantData.data)
246
+ value_array.append(vector.data.float64Data.data[
247
+ row] if not vector.isConstantVector else vector.data.numericDecimalConstantData.data)
232
248
  elif d_type == VectorType.BINARY:
233
249
  for row in range(vector.size):
234
250
  if vector.nullSet[row]:
235
251
  value_array.append(None)
236
252
  continue
237
- value_array.append(vector.data.varcharData.data[row] if not vector.isConstantVector else vector.data.varcharConstantData.data)
253
+ value_array.append(vector.data.varcharData.data[
254
+ row] if not vector.isConstantVector else vector.data.varcharConstantData.data)
238
255
  elif d_type == VectorType.FLOAT:
239
256
  for row in range(vector.size):
240
257
  if vector.nullSet[row]:
241
258
  value_array.append(None)
242
259
  continue
243
- value_array.append(vector.data.float32Data.data[row] if not vector.isConstantVector else vector.data.numericDecimalConstantData.data)
260
+ value_array.append(vector.data.float32Data.data[
261
+ row] if not vector.isConstantVector else vector.data.numericDecimalConstantData.data)
244
262
  elif d_type == VectorType.BOOLEAN:
245
263
  for row in range(vector.size):
246
264
  if vector.nullSet[row]:
247
265
  value_array.append(None)
248
266
  continue
249
- value_array.append(vector.data.boolData.data[row] if not vector.isConstantVector else vector.data.boolConstantData.data)
267
+ value_array.append(vector.data.boolData.data[
268
+ row] if not vector.isConstantVector else vector.data.boolConstantData.data)
250
269
  elif d_type == VectorType.INTEGER:
251
270
  for row in range(vector.size):
252
271
  if vector.nullSet[row]:
253
272
  value_array.append(None)
254
273
  continue
255
- value_array.append(vector.data.int32Data.data[row] if not vector.isConstantVector else vector.data.numericConstantData.data)
274
+ value_array.append(vector.data.int32Data.data[
275
+ row] if not vector.isConstantVector else vector.data.numericConstantData.data)
256
276
  else:
257
277
  value_array.append(None)
258
278
  except Exception as e:
@@ -395,6 +395,7 @@ class Cursor(DBAPICursor):
395
395
  """
396
396
  Semicolon is now not supported. So removing it from query end.
397
397
  """
398
+ operation = operation.strip() # Remove leading and trailing whitespaces.
398
399
  if operation.endswith(';'):
399
400
  operation = operation[:-1]
400
401
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e6data-python-connector
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Client for the e6data distributed SQL Engine.
5
5
  Home-page: https://github.com/e6x-labs/e6data-python-connector
6
6
  Author: Uniphi, Inc.
@@ -27,20 +27,27 @@ Requires-Dist: sqlalchemy
27
27
 
28
28
  # e6data Python Connector
29
29
 
30
- ![version](https://img.shields.io/badge/version-2.0.0-blue.svg)
30
+ ![version](https://img.shields.io/badge/version-2.0.2-blue.svg)
31
31
 
32
32
  ## Introduction
33
33
 
34
34
  The e6data Connector for Python provides an interface for writing Python applications that can connect to e6data and perform operations.
35
35
 
36
- #### Amazon Linux dependency
37
- Make sure to install C compiler dependencies and wheel before install e6data-python-connector.
36
+ ### Dependencies
37
+ Make sure to install below dependencies and wheel before install e6data-python-connector.
38
38
  ```shell
39
+ # Amazon Linux / CentOS dependencies
39
40
  yum install python3-devel gcc-c++ -y
40
41
 
42
+ # Ubuntu/Debian dependencies
43
+ apt install python3-dev g++ -y
44
+
45
+
46
+ # Pip dependencies
41
47
  pip install wheel
42
48
  ```
43
49
 
50
+
44
51
  To install the Python package, use the command below:
45
52
  ```shell
46
53
  pip install --no-cache-dir e6data-python-connector
@@ -1,10 +1,10 @@
1
1
  e6data_python_connector/__init__.py,sha256=x_VwhPQ7XLlthR-NJL9Vl7lkLBRCG2pSjmyZSBHOBpM,103
2
- e6data_python_connector/common.py,sha256=p9VqU5VpQl6bXa0oHQNtjmQyB3R90cfnJmm2PoyqaKw,9958
2
+ e6data_python_connector/common.py,sha256=nk0CDQ5j1iu8DctBOXX4QypPYmxSgIgoA-Cn1UZXLic,9976
3
3
  e6data_python_connector/constants.py,sha256=h5w0lWiFsxz__zUZRlo1f72-8mT_vt9gcWvtWh0viFI,682
4
- e6data_python_connector/datainputstream.py,sha256=sxyPwHZdwxyeQgJPnHZtuUutauwBb2TsZFC377XCGGc,10650
4
+ e6data_python_connector/datainputstream.py,sha256=nGSXn86oRpkY5orZ7Y6S0WRDNpK6hHT8ABQ-gSmhS-0,11365
5
5
  e6data_python_connector/date_time_utils.py,sha256=ew1CjhfB93trRdu8jBOy2ihZNSecDPcmxS1USmWxqzE,13623
6
6
  e6data_python_connector/dialect.py,sha256=-FFQ4mjSviqfcnDC0Ju0c1p3i4XqFLmekPd-CSZ_g0Q,10938
7
- e6data_python_connector/e6data_grpc.py,sha256=pTDfGak340wmP3aqFe-0ZNH2L2-ID6rg0LIIqxwE_Xc,20766
7
+ e6data_python_connector/e6data_grpc.py,sha256=-wPh3JVBetVPeTWTED7TMge2TbGNotgP0l5kaDqyuuY,20848
8
8
  e6data_python_connector/exceptions.py,sha256=vrUqdzMq3LjbCmvr5_TcRq9eKmdqGfe-uVjR0BJQf5U,382
9
9
  e6data_python_connector/typeId.py,sha256=2EMNWK2SO5CBReNuJphma6xp-69r9GDwwys66t-kSk0,1777
10
10
  e6data_python_connector/e6x_vector/__init__.py,sha256=YFcZTT8Cm-6Y4oTiCaqq0DT1lw2W09WqoEc5_pTAwW0,34
@@ -17,18 +17,9 @@ e6data_python_connector/server/e6x_engine_pb2.py,sha256=2aShk-jX1UQxFzMVx58gXf9N
17
17
  e6data_python_connector/server/e6x_engine_pb2.pyi,sha256=z5olI2I4xHNivRULRmsEXvuEpmxX2vlnUMk8YarmMY8,17824
18
18
  e6data_python_connector/server/e6x_engine_pb2_grpc.py,sha256=pezNVTO8oSCDcVr0fYi-zlr2X71Q6nDNeMooVNHMITo,45052
19
19
  e6data_python_connector/server/ttypes.py,sha256=uWxwSp4m6e-7SeSEckbZtSduGYmfzXWM09iy5eltBPA,21227
20
- e6xdb/__init__.py,sha256=Xl8RdRmrX8u2Qnhdess7r3z_Y6yVQknTkBYJa3FFl6w,334
21
- e6xdb/common.py,sha256=p9VqU5VpQl6bXa0oHQNtjmQyB3R90cfnJmm2PoyqaKw,9958
22
- e6xdb/constants.py,sha256=h5w0lWiFsxz__zUZRlo1f72-8mT_vt9gcWvtWh0viFI,682
23
- e6xdb/datainputstream.py,sha256=4sCN_r_IlCkJQv8QusyJvPmiIZhFPdYB9HGGaPC2lXM,9782
24
- e6xdb/date_time_utils.py,sha256=ew1CjhfB93trRdu8jBOy2ihZNSecDPcmxS1USmWxqzE,13623
25
- e6xdb/e6x.py,sha256=S6VZR2Xoh8vxboUcYQwEwwwAqWhE7gctL2brRMxWDl8,17041
26
- e6xdb/exceptions.py,sha256=vrUqdzMq3LjbCmvr5_TcRq9eKmdqGfe-uVjR0BJQf5U,382
27
- e6xdb/sqlalchemy_e6x.py,sha256=1Y8aNgXj6vBYnQ_nRGzfXdSl6gOqCJTcKWrLxk3GW4I,11833
28
- e6xdb/typeId.py,sha256=2EMNWK2SO5CBReNuJphma6xp-69r9GDwwys66t-kSk0,1777
29
- e6data_python_connector-2.0.0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
30
- e6data_python_connector-2.0.0.dist-info/METADATA,sha256=BLzRzm9a8_pXCH7VEAhKfGb2EiTFMV_MxdSXLXAc_VY,6874
31
- e6data_python_connector-2.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
32
- e6data_python_connector-2.0.0.dist-info/entry_points.txt,sha256=MDK4cAOND0preLvq2Tlpnz00wXnP_Y_UopqJsAf3U7Y,77
33
- e6data_python_connector-2.0.0.dist-info/top_level.txt,sha256=SUOb-2aAv21U0Ck3e0aF9Oq2h4hgfgEuBlBIqXpY9s0,30
34
- e6data_python_connector-2.0.0.dist-info/RECORD,,
20
+ e6data_python_connector-2.0.2.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
21
+ e6data_python_connector-2.0.2.dist-info/METADATA,sha256=W1Veb5m1ilH4WrxVQYeg6tsTxWeLWj1OTv6okr7gkLg,6976
22
+ e6data_python_connector-2.0.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
23
+ e6data_python_connector-2.0.2.dist-info/entry_points.txt,sha256=MDK4cAOND0preLvq2Tlpnz00wXnP_Y_UopqJsAf3U7Y,77
24
+ e6data_python_connector-2.0.2.dist-info/top_level.txt,sha256=ChOS6qLf-SQycXr0uBiVxomIfYfbH2SgwrOWhW79ab0,24
25
+ e6data_python_connector-2.0.2.dist-info/RECORD,,
e6xdb/__init__.py DELETED
@@ -1,10 +0,0 @@
1
- """
2
- THIS SPECIFIC FILE IS DISTRIBUTED UNDER THE UNLICENSE: http://unlicense.org.
3
-
4
- THIS MEANS YOU CAN USE THIS CODE EXAMPLE TO KICKSTART A PROJECT YOUR OWN.
5
- AFTER YOU CREATED YOUR OWN ORIGINAL WORK, YOU CAN REPLACE THIS HEADER :)
6
- """
7
-
8
- from __future__ import absolute_import
9
- from __future__ import unicode_literals
10
- __version__ = '0.0.1'
e6xdb/common.py DELETED
@@ -1,269 +0,0 @@
1
- """Package private common utilities. Do not use directly.
2
- Many docstrings in this file are based on PEP-249, which is in the public domain.
3
- """
4
-
5
- from __future__ import absolute_import
6
- from __future__ import unicode_literals
7
-
8
- import abc
9
- import collections
10
- import datetime
11
- import logging
12
- import time
13
- from builtins import bytes
14
- from builtins import int
15
- from builtins import object
16
- from builtins import str
17
-
18
- from future.utils import with_metaclass
19
- from past.builtins import basestring
20
-
21
- from e6xdb.exceptions import ProgrammingError
22
-
23
- _logger = logging.getLogger(__name__)
24
-
25
-
26
- class DBAPICursor(with_metaclass(abc.ABCMeta, object)):
27
- """Base class for some common DB-API logic"""
28
-
29
- _STATE_NONE = 0
30
- _STATE_RUNNING = 1
31
- _STATE_FINISHED = 2
32
-
33
- def __init__(self, poll_interval=1):
34
- self._poll_interval = poll_interval
35
- self._reset_state()
36
- self.lastrowid = None
37
- self._data = None
38
-
39
- def _reset_state(self):
40
- """Reset state about the previous query in preparation for running another query"""
41
- # State to return as part of DB-API
42
- self._rownumber = 0
43
-
44
- # Internal helper state
45
- self._data = collections.deque()
46
- self._columns = None
47
-
48
- def _fetch_while(self, fn):
49
- _logger.info("Commons - fetch while.... fn type - {}".format(type(fn)))
50
- while fn():
51
- _logger.info("fetching next fetch more from fetch while")
52
- self._fetch_more()
53
- if fn():
54
- time.sleep(self._poll_interval)
55
-
56
- @abc.abstractmethod
57
- def description(self):
58
- raise NotImplementedError # pragma: no cover
59
-
60
- def close(self):
61
- """By default, do nothing"""
62
- pass
63
-
64
- @abc.abstractmethod
65
- def _fetch_more(self):
66
- """Get more results, append it to ``self._data``, and update ``self._state``."""
67
- raise NotImplementedError # pragma: no cover
68
-
69
- @property
70
- def rowcount(self):
71
- """By default, return -1 to indicate that this is not supported."""
72
- return self.rowcount
73
-
74
- @abc.abstractmethod
75
- def execute(self, operation, parameters=None):
76
- """Prepare and execute a database operation (query or command).
77
- Parameters may be provided as sequence or mapping and will be bound to variables in the
78
- operation. Variables are specified in a database-specific notation (see the e6xdb's
79
- ``paramstyle`` attribute for details).
80
- Return values are not defined.
81
- """
82
- raise NotImplementedError # pragma: no cover
83
-
84
- def executemany(self, operation, seq_of_parameters):
85
- """Prepare a database operation (query or command) and then execute it against all parameter
86
- sequences or mappings found in the sequence ``seq_of_parameters``.
87
- Only the final result set is retained.
88
- Return values are not defined.
89
- """
90
- for parameters in seq_of_parameters[:-1]:
91
- self.execute(operation, parameters)
92
- # while self._state != self._STATE_FINISHED:
93
- # self._fetch_more()
94
- if seq_of_parameters:
95
- self.execute(operation, seq_of_parameters[-1])
96
-
97
- def fetchone(self):
98
- """Fetch the next row of a query result set, returning a single sequence, or ``None`` when
99
- no more data is available.
100
- An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to
101
- :py:meth:`execute` did not produce any result set or no call was issued yet.
102
- """
103
- # if self._state == self._STATE_NONE:
104
- # raise ProgrammingError("No query yet")
105
- #
106
- # # Sleep until we're done or we have some data to return
107
- # self._fetch_while(lambda: not self._data and self._state != self._STATE_FINISHED)
108
-
109
- # Sleep until we're done or we have some data to return
110
- # self._fetch_while(lambda: not self._data and self._state != self._STATE_FINISHED)
111
- if not self._data:
112
- return None
113
- else:
114
- # if self._rownumber <= 1000:
115
- # _logger.info("Commons - Breaking the loop after 1000Commons - fetch many records")
116
- # return None
117
- self._rownumber += 1
118
- return self._data.popleft()
119
-
120
- def fetchmany(self, size=None):
121
- """Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a
122
- list of tuples). An empty sequence is returned when no more rows are available.
123
- The number of rows to fetch per call is specified by the parameter. If it is not given, the
124
- cursor's arraysize determines the number of rows to be fetched. The method should try to
125
- fetch as many rows as indicated by the size parameter. If this is not possible due to the
126
- specified number of rows not being available, fewer rows may be returned.
127
- An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to
128
- :py:meth:`execute` did not produce any result set or no call was issued yet.
129
- """
130
- _logger.info("Commons - fetch many.... size - {}".format(size))
131
- rowsToReturn = self.fetchone()
132
-
133
- if rowsToReturn is None:
134
- return list()
135
- return list(rowsToReturn)
136
-
137
- def fetchall(self):
138
- """Fetch all (remaining) rows of a query result, returning them as a sequence of sequences
139
- (e.g. a list of tuples).
140
- An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to
141
- :py:meth:`execute` did not produce any result set or no call was issued yet.
142
- """
143
- _logger.info("Commons - fetch all")
144
- return list(iter(self.fetchone, None))
145
-
146
- @property
147
- def arraysize(self):
148
- """This read/write attribute specifies the number of rows to fetch at a time with
149
- :py:meth:`fetchmany`. It defaults to 1 meaning to fetch a single row at a time.
150
- """
151
- return self._arraysize
152
-
153
- @arraysize.setter
154
- def arraysize(self, value):
155
- self._arraysize = value
156
-
157
- def setinputsizes(self, sizes):
158
- """Does nothing by default"""
159
- pass
160
-
161
- def setoutputsize(self, size, column=None):
162
- """Does nothing by default"""
163
- pass
164
-
165
- #
166
- # Optional DB API Extensions
167
- #
168
-
169
- @property
170
- def rownumber(self):
171
- """This read-only attribute should provide the current 0-based index of the cursor in the
172
- result set.
173
- The index can be seen as index of the cursor in a sequence (the result set). The next fetch
174
- operation will fetch the row indexed by ``rownumber`` in that sequence.
175
- """
176
- return self._rownumber
177
-
178
- def __next__(self):
179
- """Return the next row from the currently executing SQL statement using the same semantics
180
- as :py:meth:`fetchone`. A ``StopIteration`` exception is raised when the result set is
181
- exhausted.
182
- """
183
- _logger.info("Commons - fetching the next row")
184
- one = self.fetchone()
185
- if one is None:
186
- raise StopIteration
187
- else:
188
- return one
189
-
190
- next = __next__
191
-
192
- def __iter__(self):
193
- """Return self to make cursors compatible to the iteration protocol."""
194
- return self
195
-
196
-
197
- class DBAPITypeObject(object):
198
- # Taken from http://www.python.org/dev/peps/pep-0249/#implementation-hints
199
- def __init__(self, *values):
200
- self.values = values
201
-
202
- def __cmp__(self, other):
203
- if other in self.values:
204
- return 0
205
- if other < self.values:
206
- return 1
207
- else:
208
- return -1
209
-
210
-
211
- class ParamEscaper(object):
212
- _DATE_FORMAT = "%Y-%m-%d"
213
- _TIME_FORMAT = "%H:%M:%S.%f"
214
- _DATETIME_FORMAT = "{} {}".format(_DATE_FORMAT, _TIME_FORMAT)
215
-
216
- def escape_args(self, parameters):
217
- if isinstance(parameters, dict):
218
- return {k: self.escape_item(v) for k, v in parameters.items()}
219
- elif isinstance(parameters, (list, tuple)):
220
- return tuple(self.escape_item(x) for x in parameters)
221
- else:
222
- raise ProgrammingError("Unsupported param format: {}".format(parameters))
223
-
224
- def escape_number(self, item):
225
- return item
226
-
227
- def escape_string(self, item):
228
- # Need to decode UTF-8 because of old sqlalchemy.
229
- # Newer SQLAlchemy checks dialect.supports_unicode_binds before encoding Unicode strings
230
- # as byte strings. The old version always encodes Unicode as byte strings, which breaks
231
- # string formatting here.
232
- if isinstance(item, bytes):
233
- item = item.decode('utf-8')
234
- # This is good enough when backslashes are literal, newlines are just followed, and the way
235
- # to escape a single quote is to put two single quotes.
236
- # (i.e. only special character is single quote)
237
- return "'{}'".format(item.replace("'", "''"))
238
-
239
- def escape_sequence(self, item):
240
- l = map(str, map(self.escape_item, item))
241
- return '(' + ','.join(l) + ')'
242
-
243
- def escape_datetime(self, item, format, cutoff=0):
244
- dt_str = item.strftime(format)
245
- formatted = dt_str[:-cutoff] if cutoff and format.endswith(".%f") else dt_str
246
- return "'{}'".format(formatted)
247
-
248
- def escape_item(self, item):
249
- if item is None:
250
- return 'NULL'
251
- elif isinstance(item, (int, float)):
252
- return self.escape_number(item)
253
- elif isinstance(item, basestring):
254
- return self.escape_string(item)
255
- elif isinstance(item, collections.Iterable):
256
- return self.escape_sequence(item)
257
- elif isinstance(item, datetime.datetime):
258
- return self.escape_datetime(item, self._DATETIME_FORMAT)
259
- elif isinstance(item, datetime.date):
260
- return self.escape_datetime(item, self._DATE_FORMAT)
261
- else:
262
- raise ProgrammingError("Unsupported object {}".format(item))
263
-
264
-
265
- class UniversalSet(object):
266
- """set containing everything"""
267
-
268
- def __contains__(self, item):
269
- return True
e6xdb/constants.py DELETED
@@ -1,32 +0,0 @@
1
- import pytz
2
-
3
- PRIMITIVE_TYPES = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20, 21}
4
- COMPLEX_TYPES = {10, 11, 12, 13, 14}
5
- COLLECTION_TYPES = {10, 11}
6
- TYPE_NAMES = {
7
- 0: "BOOLEAN",
8
- 1: "TINYINT",
9
- 2: "SMALLINT",
10
- 3: "INT",
11
- 4: "BIGINT",
12
- 5: "FLOAT",
13
- 6: "DOUBLE",
14
- 7: "STRING",
15
- 8: "TIMESTAMP",
16
- 9: "BINARY",
17
- 10: "ARRAY",
18
- 11: "MAP",
19
- 12: "STRUCT",
20
- 13: "UNIONTYPE",
21
- 15: "DECIMAL",
22
- 16: "NULL",
23
- 17: "DATE",
24
- 18: "VARCHAR",
25
- 19: "CHAR",
26
- 20: "INTERVAL_YEAR_MONTH",
27
- 21: "INTERVAL_DAY_TIME",
28
- }
29
- CHARACTER_MAXIMUM_LENGTH = "characterMaximumLength"
30
- PRECISION = "precision"
31
- SCALE = "scale"
32
- ZONE = pytz.timezone('UTC')