velocity-python 0.0.33__py3-none-any.whl → 0.0.34__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.

Potentially problematic release.


This version of velocity-python might be problematic. Click here for more details.

velocity/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = version = "0.0.33"
1
+ __version__ = version = "0.0.34"
2
2
 
3
3
  from . import aws
4
4
  from . import db
@@ -1,5 +1,6 @@
1
1
  from functools import wraps
2
2
  from velocity.db import exceptions
3
+ import traceback
3
4
 
4
5
 
5
6
  def retry_on_dup_key(function):
@@ -55,6 +56,7 @@ def return_default(
55
56
  if result is None:
56
57
  result = default
57
58
  except f.exceptions as e:
59
+ traceback.print_exc()
58
60
  self.tx.rollback_savepoint(sp, cursor=self.cursor)
59
61
  return f.default
60
62
  self.tx.release_savepoint(sp, cursor=self.cursor)
@@ -169,6 +169,8 @@ class Engine(object):
169
169
  return function(*args, **kwds)
170
170
  except exceptions.DbRetryTransaction as e:
171
171
  if e.args and e.args[0]:
172
+ print(e)
173
+ print("**Retry Transaction. Rollback and start over")
172
174
  _tx.rollback()
173
175
  continue
174
176
  retry_count += 1
@@ -249,6 +251,7 @@ class Engine(object):
249
251
  conf["database"] = database
250
252
  if "dbname" in conf:
251
253
  conf["dbname"] = database
254
+
252
255
  return self
253
256
 
254
257
  def set_config(self, config):
@@ -6,6 +6,7 @@ from velocity.db.core.column import Column
6
6
  from velocity.db.core.database import Database
7
7
  from velocity.db.core.sequence import Sequence
8
8
  from velocity.misc.db import randomword
9
+ import traceback
9
10
 
10
11
 
11
12
  debug = False
@@ -29,6 +30,11 @@ class Transaction(object):
29
30
 
30
31
  def __exit__(self, exc_type, exc_val, exc_tb):
31
32
  if exc_type:
33
+ if debug:
34
+ print("Transaction.__exit__")
35
+ tb_str = "".join(traceback.format_exception(exc_type, exc_val, exc_tb))
36
+ if debug:
37
+ print(tb_str)
32
38
  self.rollback()
33
39
  self.close()
34
40
 
@@ -206,3 +212,10 @@ class Transaction(object):
206
212
  result = self.execute(sql, vals)
207
213
  self.__pg_types = dict(result.as_tuple())
208
214
  return self.__pg_types
215
+
216
+ def switch_to_database(self, name):
217
+ if self.connection:
218
+ self.connection.close()
219
+ self.connection = None
220
+ self.engine.switch_to_database(name)
221
+ return self
@@ -445,7 +445,7 @@ class SQL(object):
445
445
  trigger = "".format(name)
446
446
  sql = []
447
447
  if drop:
448
- sql.append(cls.drop_table(fqtn))
448
+ sql.append(cls.drop_table(fqtn)[0])
449
449
  sql.append(
450
450
  """
451
451
  CREATE TABLE {0} (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: velocity-python
3
- Version: 0.0.33
3
+ Version: 0.0.34
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Paul Perez <pperez@codeclubs.org>
6
6
  Project-URL: Homepage, https://codeclubs.org/projects/velocity
@@ -1,4 +1,4 @@
1
- velocity/__init__.py,sha256=jXPXoZlV9Xfj5mEZoEAogwD_7s7LasEz4_r3jJR7Zjk,88
1
+ velocity/__init__.py,sha256=hlMhCqzGev3NaHpaO6Uf0N-bpmP_fv3PUHIpqrGgInY,88
2
2
  velocity/aws/__init__.py,sha256=GBTEr02whnCH3TG-BWCpUC3KfHY3uNxD21g0OvsVJnc,598
3
3
  velocity/aws/handlers/__init__.py,sha256=xnpFZJVlC2uoeeFW4zuPST8wA8ajaQDky5Y6iXZzi3A,172
4
4
  velocity/aws/handlers/context.py,sha256=UIjNR83y2NSIyK8HMPX8t5tpJHFNabiZvNgmmdQL3HA,1822
@@ -9,17 +9,17 @@ velocity/db/__init__.py,sha256=vrn2AFNAKaqTdnPwLFS0OcREcCtzUCOodlmH54U7ADg,200
9
9
  velocity/db/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  velocity/db/core/column.py,sha256=nibAue9zBY3ln7S81tgMvCDzpAmrHlBqAjvvzatzB5A,6258
11
11
  velocity/db/core/database.py,sha256=r4S_x9ntkdXkwqdPqSgVQ7YB2r68SbKssHyXfSfCJYo,1875
12
- velocity/db/core/decorators.py,sha256=q3_0j06vZF9J-pPcLjsR2wftp4iXjlGgJ2l70WdtbUo,3271
13
- velocity/db/core/engine.py,sha256=qubySirnGymBYfQb5hF6EdYUhNr-GSjOmvRNswG9RFI,14535
12
+ velocity/db/core/decorators.py,sha256=HxlelX8BPuGz1T2owhZwHnLxHg5aywUgr1tXvg1zghQ,3326
13
+ velocity/db/core/engine.py,sha256=yleohNqeqLfsTapOamKW-aiGxMooQPcR61p7vN9cCVo,14647
14
14
  velocity/db/core/exceptions.py,sha256=MOWyA1mlMe8eWbFkEHK0Lp9czdplpRyqbAn2JfGmMrM,707
15
15
  velocity/db/core/result.py,sha256=keE-SKn4Uw08uoiA_8FdaMzBfiaAIxidQEEsl3TM86U,4945
16
16
  velocity/db/core/row.py,sha256=AHopXrrQUp5dCXEMLEDm0iAhswKDtMUdBxjTtPQ7Udk,5659
17
17
  velocity/db/core/sequence.py,sha256=4WkXJUE1tea4bo3y8JzJq6KgtU_1yAV6rp3HHrOVAoI,1177
18
18
  velocity/db/core/table.py,sha256=0CvuhHWEMOC6I3_ycXGU35zzIxIipfj1XRpnzIiCPt8,19942
19
- velocity/db/core/transaction.py,sha256=XeqGkgrleIqC8krrDcqVXWiBAjXx9z67ZecJNjELgiw,6641
19
+ velocity/db/core/transaction.py,sha256=S0ojO40u4Ads_QhofUYAXvHcvhs1W3ir2kyhe5d-btM,7067
20
20
  velocity/db/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  velocity/db/servers/mysql.py,sha256=O3-lP1Y4VmdeAL5PcYcj_mulJBeK7vcoei_v23oo8qc,24272
22
- velocity/db/servers/postgres.py,sha256=aA4Fkz-PTo-Vi9kpDvWWMt2snv4r93PtQYDzgCg1XIs,42723
22
+ velocity/db/servers/postgres.py,sha256=E8JRRVW3_YrpbmcYM-ZbVgk-BoVZajlWUr4Ni3KtQvg,42726
23
23
  velocity/db/servers/sqlite.py,sha256=_PGg6ECHdOyOMn4tTWX4WlectAukW3Dov7cZxHbVtBM,36198
24
24
  velocity/db/servers/sqlserver.py,sha256=ACdkTyJzdFzN-RpmOabKgmMPtCdHzT-FwYH00UpSNyM,34465
25
25
  velocity/misc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,8 +32,8 @@ velocity/misc/timer.py,sha256=cN3aS0t6HLlhYfF2Ir6ihJehxNrWf9ebaLzXUaWRKEA,1637
32
32
  velocity/misc/conv/__init__.py,sha256=MLYF58QHjzfDSxb1rdnmLnuEQCa3gnhzzZ30CwZVvQo,40
33
33
  velocity/misc/conv/iconv.py,sha256=d3Vafl0xaMjWD3aeWDnfraOrLinAFjGRPqiozoRunio,5798
34
34
  velocity/misc/conv/oconv.py,sha256=WdyGhifokFkta6Q0jBc9z9dk34rU0htMR_e0eUY-Vyg,6018
35
- velocity_python-0.0.33.dist-info/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
36
- velocity_python-0.0.33.dist-info/METADATA,sha256=ppSE2wCyHGXtSv0wx6OGZFzKsWaDMpX05KjaI2eZ6as,8522
37
- velocity_python-0.0.33.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
- velocity_python-0.0.33.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
39
- velocity_python-0.0.33.dist-info/RECORD,,
35
+ velocity_python-0.0.34.dist-info/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
36
+ velocity_python-0.0.34.dist-info/METADATA,sha256=HxyHJU7LxOIbkqWqp903MgxLEQgGtpJzk-BH-eH8d1Y,8522
37
+ velocity_python-0.0.34.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
+ velocity_python-0.0.34.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
39
+ velocity_python-0.0.34.dist-info/RECORD,,