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

Files changed (40) hide show
  1. velocity/__init__.py +1 -1
  2. velocity/aws/handlers/mixins/__init__.py +16 -0
  3. velocity/aws/handlers/mixins/activity_tracker.py +142 -0
  4. velocity/aws/handlers/mixins/error_handler.py +192 -0
  5. velocity/aws/handlers/mixins/legacy_mixin.py +53 -0
  6. velocity/aws/handlers/mixins/standard_mixin.py +73 -0
  7. velocity/db/servers/base/__init__.py +9 -0
  8. velocity/db/servers/base/initializer.py +69 -0
  9. velocity/db/servers/base/operators.py +98 -0
  10. velocity/db/servers/base/sql.py +503 -0
  11. velocity/db/servers/base/types.py +135 -0
  12. velocity/db/servers/mysql/__init__.py +64 -0
  13. velocity/db/servers/mysql/operators.py +54 -0
  14. velocity/db/servers/{mysql_reserved.py → mysql/reserved.py} +2 -14
  15. velocity/db/servers/mysql/sql.py +569 -0
  16. velocity/db/servers/mysql/types.py +107 -0
  17. velocity/db/servers/postgres/__init__.py +40 -0
  18. velocity/db/servers/postgres/operators.py +34 -0
  19. velocity/db/servers/postgres/sql.py +4 -3
  20. velocity/db/servers/postgres/types.py +88 -2
  21. velocity/db/servers/sqlite/__init__.py +52 -0
  22. velocity/db/servers/sqlite/operators.py +52 -0
  23. velocity/db/servers/sqlite/reserved.py +20 -0
  24. velocity/db/servers/sqlite/sql.py +530 -0
  25. velocity/db/servers/sqlite/types.py +92 -0
  26. velocity/db/servers/sqlserver/__init__.py +64 -0
  27. velocity/db/servers/sqlserver/operators.py +47 -0
  28. velocity/db/servers/sqlserver/reserved.py +32 -0
  29. velocity/db/servers/sqlserver/sql.py +625 -0
  30. velocity/db/servers/sqlserver/types.py +114 -0
  31. {velocity_python-0.0.129.dist-info → velocity_python-0.0.132.dist-info}/METADATA +1 -1
  32. {velocity_python-0.0.129.dist-info → velocity_python-0.0.132.dist-info}/RECORD +35 -16
  33. velocity/db/servers/mysql.py +0 -640
  34. velocity/db/servers/sqlite.py +0 -968
  35. velocity/db/servers/sqlite_reserved.py +0 -208
  36. velocity/db/servers/sqlserver.py +0 -921
  37. velocity/db/servers/sqlserver_reserved.py +0 -314
  38. {velocity_python-0.0.129.dist-info → velocity_python-0.0.132.dist-info}/WHEEL +0 -0
  39. {velocity_python-0.0.129.dist-info → velocity_python-0.0.132.dist-info}/licenses/LICENSE +0 -0
  40. {velocity_python-0.0.129.dist-info → velocity_python-0.0.132.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,114 @@
1
+ import decimal
2
+ import datetime
3
+ from ..base.types import BaseTypes
4
+
5
+
6
+ class TYPES(BaseTypes):
7
+ """
8
+ SQL Server-specific type mapping implementation.
9
+ """
10
+
11
+ TEXT = "NVARCHAR(MAX)"
12
+ VARCHAR = "VARCHAR"
13
+ NVARCHAR = "NVARCHAR"
14
+ INTEGER = "INT"
15
+ BIGINT = "BIGINT"
16
+ SMALLINT = "SMALLINT"
17
+ TINYINT = "TINYINT"
18
+ NUMERIC = "DECIMAL"
19
+ DECIMAL = "DECIMAL"
20
+ FLOAT = "FLOAT"
21
+ REAL = "REAL"
22
+ MONEY = "MONEY"
23
+ DATETIME = "DATETIME"
24
+ DATETIME2 = "DATETIME2"
25
+ DATE = "DATE"
26
+ TIME = "TIME"
27
+ TIMESTAMP = "ROWVERSION"
28
+ BOOLEAN = "BIT"
29
+ BINARY = "VARBINARY(MAX)"
30
+ UNIQUEIDENTIFIER = "UNIQUEIDENTIFIER"
31
+
32
+ @classmethod
33
+ def get_type(cls, v):
34
+ """
35
+ Returns a suitable SQL type string for a Python value/object (SQL Server).
36
+ """
37
+ is_special, special_val = cls._handle_special_values(v)
38
+ if is_special:
39
+ return special_val
40
+
41
+ if isinstance(v, str) or v is str:
42
+ return cls.TEXT
43
+ if isinstance(v, bool) or v is bool:
44
+ return cls.BOOLEAN
45
+ if isinstance(v, int) or v is int:
46
+ return cls.BIGINT
47
+ if isinstance(v, float) or v is float:
48
+ return f"{cls.DECIMAL}(19, 6)"
49
+ if isinstance(v, decimal.Decimal) or v is decimal.Decimal:
50
+ return f"{cls.DECIMAL}(19, 6)"
51
+ if isinstance(v, datetime.datetime) or v is datetime.datetime:
52
+ return cls.DATETIME2
53
+ if isinstance(v, datetime.date) or v is datetime.date:
54
+ return cls.DATE
55
+ if isinstance(v, datetime.time) or v is datetime.time:
56
+ return cls.TIME
57
+ if isinstance(v, bytes) or v is bytes:
58
+ return cls.BINARY
59
+ return cls.TEXT
60
+
61
+ @classmethod
62
+ def get_conv(cls, v):
63
+ """
64
+ Returns a base SQL type for expression usage (SQL Server).
65
+ """
66
+ is_special, special_val = cls._handle_special_values(v)
67
+ if is_special:
68
+ return special_val
69
+
70
+ if isinstance(v, str) or v is str:
71
+ return cls.NVARCHAR
72
+ if isinstance(v, bool) or v is bool:
73
+ return cls.BOOLEAN
74
+ if isinstance(v, int) or v is int:
75
+ return cls.BIGINT
76
+ if isinstance(v, float) or v is float:
77
+ return cls.DECIMAL
78
+ if isinstance(v, decimal.Decimal) or v is decimal.Decimal:
79
+ return cls.DECIMAL
80
+ if isinstance(v, datetime.datetime) or v is datetime.datetime:
81
+ return cls.DATETIME2
82
+ if isinstance(v, datetime.date) or v is datetime.date:
83
+ return cls.DATE
84
+ if isinstance(v, datetime.time) or v is datetime.time:
85
+ return cls.TIME
86
+ if isinstance(v, bytes) or v is bytes:
87
+ return cls.BINARY
88
+ return cls.NVARCHAR
89
+
90
+ @classmethod
91
+ def py_type(cls, v):
92
+ """
93
+ Returns the Python type that corresponds to an SQL type string (SQL Server).
94
+ """
95
+ v = str(v).upper()
96
+ if v in (cls.INTEGER, cls.SMALLINT, cls.BIGINT, cls.TINYINT):
97
+ return int
98
+ if v in (cls.NUMERIC, cls.DECIMAL, cls.MONEY) or "DECIMAL" in v:
99
+ return decimal.Decimal
100
+ if v in (cls.FLOAT, cls.REAL):
101
+ return float
102
+ if v in (cls.TEXT, cls.VARCHAR, cls.NVARCHAR) or "VARCHAR" in v or "CHAR" in v:
103
+ return str
104
+ if v == cls.BOOLEAN or v == "BIT":
105
+ return bool
106
+ if v == cls.DATE:
107
+ return datetime.date
108
+ if v == cls.TIME:
109
+ return datetime.time
110
+ if v in (cls.DATETIME, cls.DATETIME2):
111
+ return datetime.datetime
112
+ if v == cls.BINARY or "BINARY" in v:
113
+ return bytes
114
+ raise Exception(f"Unmapped SQL Server type {v}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: velocity-python
3
- Version: 0.0.129
3
+ Version: 0.0.132
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Velocity Team <info@codeclubs.org>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- velocity/__init__.py,sha256=raN52kF2FO4NfAP3hRva62_N703YomMF0M-iO78MHTI,147
1
+ velocity/__init__.py,sha256=00dsHQL1ODP0BceKWcpIfeIkx7Oe6WMzXiMNO34MkdM,147
2
2
  velocity/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  velocity/app/invoices.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  velocity/app/orders.py,sha256=fr1oTBjSFfyeMBUXRG06LV4jgwrlwYNL5mbEBleFwf0,6328
@@ -13,6 +13,11 @@ velocity/aws/handlers/exceptions.py,sha256=i4wcB8ZSWUHglX2xnesDlWLsU9AMYU72cHCWR
13
13
  velocity/aws/handlers/lambda_handler.py,sha256=0wa_CHyJOaI5RsHqB0Ae83-B-SwlKR0qkGUlc7jitQI,4427
14
14
  velocity/aws/handlers/response.py,sha256=s2Kw7yv5zAir1mEmfv6yBVIvRcRQ__xyryf1SrvtiRc,9317
15
15
  velocity/aws/handlers/sqs_handler.py,sha256=azuV8DrFOh0hM13EnPzyYVBS-3fLe2fn9OPc4ho7sGc,3375
16
+ velocity/aws/handlers/mixins/__init__.py,sha256=_zyEpsnKikF7D7X-F0GA4cyIrQ6wBq7k5j6Vhp17vaQ,623
17
+ velocity/aws/handlers/mixins/activity_tracker.py,sha256=b2Cu46FM0fLS2-FkWXXAPw6yvMV_Viu5-IlpGkVAlmk,5254
18
+ velocity/aws/handlers/mixins/error_handler.py,sha256=uN2YF9v-3LzS3o_HdVpO-XMcPy3sS7SHjUg_LfbsG7Q,6803
19
+ velocity/aws/handlers/mixins/legacy_mixin.py,sha256=_YhiPU-zzXQjGNSAKhoUwfTFlnczmU-3BkwNFqr0hYE,2117
20
+ velocity/aws/handlers/mixins/standard_mixin.py,sha256=-wBX0PFlZAnxQsaMDEWr-xmU8TcRbQ4BZD3wmAKR2d0,2489
16
21
  velocity/db/__init__.py,sha256=7XRUHY2af0HL1jvL0SAMpxSe5a2Phbkm-YLJCvC1C_0,739
17
22
  velocity/db/exceptions.py,sha256=XHREJvzNctrtYE-ScBRLnbk7thxTswkfWojKhMmBmd8,2185
18
23
  velocity/db/utils.py,sha256=IoXeAL_0wZE15gbxlb2TtNdHzUSV9bIvw8jNkqjz38o,7020
@@ -27,18 +32,32 @@ velocity/db/core/sequence.py,sha256=VMBc0ZjGnOaWTwKW6xMNTdP8rZ2umQ8ml4fHTTwuGq4,
27
32
  velocity/db/core/table.py,sha256=EVoZZ6s21ZVqqT7VgH9Rr0SsFbsLLk6gtwvKwgbcWTQ,34708
28
33
  velocity/db/core/transaction.py,sha256=unjmVkkfb7D8Wow6V8V8aLaxUZo316i--ksZxc4-I1Q,6613
29
34
  velocity/db/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- velocity/db/servers/mysql.py,sha256=UGsHOpbRwDDI1o7LnkDeIZ5IgQ48vQEae_Bd8E0nv64,20880
31
- velocity/db/servers/mysql_reserved.py,sha256=CYdZJBOpS-ptImaRZcmVLumdUdbFuf9Tfdzu_mUT5wY,3507
32
- velocity/db/servers/sqlite.py,sha256=en1whjOE98JINXTHPsAA-qUqS_ts_eQP5ImqeLamk4U,33234
33
- velocity/db/servers/sqlite_reserved.py,sha256=-xmjl-Hgu6lKqkCAXq_6U8_aJX6gvaMgLMLdCt-Ej7o,3006
34
- velocity/db/servers/sqlserver.py,sha256=Lz8H4dg1ql34J3ufSM9o7by4wguJXACsWESp_zxgAFU,29914
35
- velocity/db/servers/sqlserver_reserved.py,sha256=3LGQYU0qfvk6AbKety96gbzzfLbZ0dNHDPLxKGvvi4Q,4596
36
35
  velocity/db/servers/tablehelper.py,sha256=Q48ObN5KD_U2sBP0GUcjaQjKeE4Hr351sPQirwQ0_1s,22163
37
- velocity/db/servers/postgres/__init__.py,sha256=saeE5iySVYMHCwlKMsHFYdPJmuLy33I9BpPUE0czUas,457
38
- velocity/db/servers/postgres/operators.py,sha256=A2T1qFwhzPl0fdXVhLZJhh5Qfx-qF8oZsDnxnq2n_V8,389
36
+ velocity/db/servers/base/__init__.py,sha256=5--XJUeEAm7O6Ns2C_ODCr5TjFhdAge-zApZCT0LGTQ,285
37
+ velocity/db/servers/base/initializer.py,sha256=HDwDG7bsxssIvO_qss0X2HVIi3BE1wmnqHeEeqEsosw,2288
38
+ velocity/db/servers/base/operators.py,sha256=kUEorYuAKMc0en8Ufs4xe3rAOT65UgQmLQEKC2aIELs,2755
39
+ velocity/db/servers/base/sql.py,sha256=w1EjfyrzosFUE0zG2fA3R41JyBnOtJuHAMgEldff9eY,13367
40
+ velocity/db/servers/base/types.py,sha256=3LBxFCD35eeIsIqftpAJh0JjUVonDYemz2n6AMtKHqw,4033
41
+ velocity/db/servers/mysql/__init__.py,sha256=Pcu6PNozHMcyoPy7a6FFnpqvVnfUMbe8fJCV7v1IPeQ,2123
42
+ velocity/db/servers/mysql/operators.py,sha256=wHmVSPxlPGbOdvQEmsfKhD25H8djovSbNcmacLHDVkI,1273
43
+ velocity/db/servers/mysql/reserved.py,sha256=s-aFMwYJpZ_1FBcCMU8fOdhml2ET58-59ZnUm7iw5OU,3312
44
+ velocity/db/servers/mysql/sql.py,sha256=OdfpoOOeJip5_O2HRNSA7_gtiQfXgELGbrKpu_NP878,18115
45
+ velocity/db/servers/mysql/types.py,sha256=BMQf4TpsRo1JN-yOl1nSItTO-Juu2piSTNy5o_djBeM,3486
46
+ velocity/db/servers/postgres/__init__.py,sha256=g3WZlvUGtYcomorsKhCG6q87cAsDQ0kGtm1S0I9r9vc,1900
47
+ velocity/db/servers/postgres/operators.py,sha256=y9k6enReeR5hJxU_lYYR2epoaw4qCxEqmYJJ5jjaVWA,1166
39
48
  velocity/db/servers/postgres/reserved.py,sha256=5tKLaqFV-HrWRj-nsrxl5KGbmeM3ukn_bPZK36XEu8M,3648
40
- velocity/db/servers/postgres/sql.py,sha256=kHGiJv2KCmdL4LnyPnbd1PZH3J0smTWpRF2EuUMsBnw,41796
41
- velocity/db/servers/postgres/types.py,sha256=Wa45ppVf_pdWul-jYWFRGMl6IdSq8dAp10SKnhL7osQ,3757
49
+ velocity/db/servers/postgres/sql.py,sha256=BXHi-hA-pWN4mBZKDYXWfmRccvvsSgWnyxLlpl9bvR4,41870
50
+ velocity/db/servers/postgres/types.py,sha256=W71x8iRx-IIJkQSjb29k-KGkqp-QS6SxB0BHYXd4k8w,6955
51
+ velocity/db/servers/sqlite/__init__.py,sha256=1puU3MJPcUai1dUr2EbVPqH-xPUPoGlO3oI51ALQc3w,1755
52
+ velocity/db/servers/sqlite/operators.py,sha256=VzZgph8RrnHkIVqqWGqnJwcafgBzc_8ZQp-M8tMl-mw,1221
53
+ velocity/db/servers/sqlite/reserved.py,sha256=4vOI06bjt8wg9KxdzDTF-iOd-ewY23NvSzthpdty2fA,1298
54
+ velocity/db/servers/sqlite/sql.py,sha256=VvI2KBLivSyd42zYg221DVRjrSSOEDjXT9SM2zbFAEM,16701
55
+ velocity/db/servers/sqlite/types.py,sha256=jpCJeV25x4Iytf6D6GXgK3hVYFAAFV4WKJC-d-m4kdU,3102
56
+ velocity/db/servers/sqlserver/__init__.py,sha256=FqyHH5Z9ShMf-aZFVDGzuuhC4m5TX6nHI4fMVAJgtD4,2170
57
+ velocity/db/servers/sqlserver/operators.py,sha256=xK8_doDLssS38SRs1NoAI7XTO0-gNGMDS76nTVru4kE,1104
58
+ velocity/db/servers/sqlserver/reserved.py,sha256=Gn5n9DjxcjM-7PsIZPYigD6XLvMAYGnz1IrPuN7Dp2Y,2120
59
+ velocity/db/servers/sqlserver/sql.py,sha256=b9UgFGma_FeY0S4VK9Yqn9QACS1SAZhJsEpA9muoHQI,20559
60
+ velocity/db/servers/sqlserver/types.py,sha256=FAODYEO137m-WugpM89f9bQN9q6S2cjjUaz0a9gfE6M,3745
42
61
  velocity/misc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
62
  velocity/misc/db.py,sha256=MPgt-kkukKR_Wh_S_5W-MyDgaeoZ4YLoDJ54wU2ppm4,2830
44
63
  velocity/misc/export.py,sha256=jm-NKI0r-d0fS8B7axW0zHf4Qx0RgEJXCTMKRMdeaps,5110
@@ -50,8 +69,8 @@ velocity/misc/tools.py,sha256=4TWa-ja2gMZJr1EhqTKsJNirvDclCruyRGMttPhCIGw,1487
50
69
  velocity/misc/conv/__init__.py,sha256=qhHFl_UqW5tjPm--6shO171IysWIdH3mmp3uwiQVyqY,70
51
70
  velocity/misc/conv/iconv.py,sha256=16aPWtreHCxmpl5ufku0KWWZj8PIUFI5J1dP0aXyM3o,10794
52
71
  velocity/misc/conv/oconv.py,sha256=h5Lo05DqOQnxoD3y6Px_MQP_V-pBbWf8Hkgkb9Xp1jk,6032
53
- velocity_python-0.0.129.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
54
- velocity_python-0.0.129.dist-info/METADATA,sha256=b9Qgbzs01L47ngUPePYLio2dEkWKdpED-AupPLl3W4Y,34262
55
- velocity_python-0.0.129.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
- velocity_python-0.0.129.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
57
- velocity_python-0.0.129.dist-info/RECORD,,
72
+ velocity_python-0.0.132.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
73
+ velocity_python-0.0.132.dist-info/METADATA,sha256=IN1S72jZd3pcLwI6g1r3W0_GUnlRG8Nqlo0BItc9QXY,34262
74
+ velocity_python-0.0.132.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
75
+ velocity_python-0.0.132.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
76
+ velocity_python-0.0.132.dist-info/RECORD,,