velocity-python 0.0.131__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.
- velocity/__init__.py +1 -1
- velocity/db/servers/base/__init__.py +9 -0
- velocity/db/servers/base/initializer.py +69 -0
- velocity/db/servers/base/operators.py +98 -0
- velocity/db/servers/base/sql.py +503 -0
- velocity/db/servers/base/types.py +135 -0
- velocity/db/servers/mysql/__init__.py +64 -0
- velocity/db/servers/mysql/operators.py +54 -0
- velocity/db/servers/{mysql_reserved.py → mysql/reserved.py} +2 -14
- velocity/db/servers/mysql/sql.py +569 -0
- velocity/db/servers/mysql/types.py +107 -0
- velocity/db/servers/postgres/__init__.py +40 -0
- velocity/db/servers/postgres/operators.py +34 -0
- velocity/db/servers/postgres/sql.py +4 -3
- velocity/db/servers/postgres/types.py +88 -2
- velocity/db/servers/sqlite/__init__.py +52 -0
- velocity/db/servers/sqlite/operators.py +52 -0
- velocity/db/servers/sqlite/reserved.py +20 -0
- velocity/db/servers/sqlite/sql.py +530 -0
- velocity/db/servers/sqlite/types.py +92 -0
- velocity/db/servers/sqlserver/__init__.py +64 -0
- velocity/db/servers/sqlserver/operators.py +47 -0
- velocity/db/servers/sqlserver/reserved.py +32 -0
- velocity/db/servers/sqlserver/sql.py +625 -0
- velocity/db/servers/sqlserver/types.py +114 -0
- {velocity_python-0.0.131.dist-info → velocity_python-0.0.132.dist-info}/METADATA +1 -1
- {velocity_python-0.0.131.dist-info → velocity_python-0.0.132.dist-info}/RECORD +30 -16
- velocity/db/servers/mysql.py +0 -640
- velocity/db/servers/sqlite.py +0 -968
- velocity/db/servers/sqlite_reserved.py +0 -208
- velocity/db/servers/sqlserver.py +0 -921
- velocity/db/servers/sqlserver_reserved.py +0 -314
- {velocity_python-0.0.131.dist-info → velocity_python-0.0.132.dist-info}/WHEEL +0 -0
- {velocity_python-0.0.131.dist-info → velocity_python-0.0.132.dist-info}/licenses/LICENSE +0 -0
- {velocity_python-0.0.131.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,4 +1,4 @@
|
|
|
1
|
-
velocity/__init__.py,sha256=
|
|
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
|
|
@@ -32,18 +32,32 @@ velocity/db/core/sequence.py,sha256=VMBc0ZjGnOaWTwKW6xMNTdP8rZ2umQ8ml4fHTTwuGq4,
|
|
|
32
32
|
velocity/db/core/table.py,sha256=EVoZZ6s21ZVqqT7VgH9Rr0SsFbsLLk6gtwvKwgbcWTQ,34708
|
|
33
33
|
velocity/db/core/transaction.py,sha256=unjmVkkfb7D8Wow6V8V8aLaxUZo316i--ksZxc4-I1Q,6613
|
|
34
34
|
velocity/db/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
velocity/db/servers/mysql.py,sha256=UGsHOpbRwDDI1o7LnkDeIZ5IgQ48vQEae_Bd8E0nv64,20880
|
|
36
|
-
velocity/db/servers/mysql_reserved.py,sha256=CYdZJBOpS-ptImaRZcmVLumdUdbFuf9Tfdzu_mUT5wY,3507
|
|
37
|
-
velocity/db/servers/sqlite.py,sha256=en1whjOE98JINXTHPsAA-qUqS_ts_eQP5ImqeLamk4U,33234
|
|
38
|
-
velocity/db/servers/sqlite_reserved.py,sha256=-xmjl-Hgu6lKqkCAXq_6U8_aJX6gvaMgLMLdCt-Ej7o,3006
|
|
39
|
-
velocity/db/servers/sqlserver.py,sha256=Lz8H4dg1ql34J3ufSM9o7by4wguJXACsWESp_zxgAFU,29914
|
|
40
|
-
velocity/db/servers/sqlserver_reserved.py,sha256=3LGQYU0qfvk6AbKety96gbzzfLbZ0dNHDPLxKGvvi4Q,4596
|
|
41
35
|
velocity/db/servers/tablehelper.py,sha256=Q48ObN5KD_U2sBP0GUcjaQjKeE4Hr351sPQirwQ0_1s,22163
|
|
42
|
-
velocity/db/servers/
|
|
43
|
-
velocity/db/servers/
|
|
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
|
|
44
48
|
velocity/db/servers/postgres/reserved.py,sha256=5tKLaqFV-HrWRj-nsrxl5KGbmeM3ukn_bPZK36XEu8M,3648
|
|
45
|
-
velocity/db/servers/postgres/sql.py,sha256=
|
|
46
|
-
velocity/db/servers/postgres/types.py,sha256=
|
|
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
|
|
47
61
|
velocity/misc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
62
|
velocity/misc/db.py,sha256=MPgt-kkukKR_Wh_S_5W-MyDgaeoZ4YLoDJ54wU2ppm4,2830
|
|
49
63
|
velocity/misc/export.py,sha256=jm-NKI0r-d0fS8B7axW0zHf4Qx0RgEJXCTMKRMdeaps,5110
|
|
@@ -55,8 +69,8 @@ velocity/misc/tools.py,sha256=4TWa-ja2gMZJr1EhqTKsJNirvDclCruyRGMttPhCIGw,1487
|
|
|
55
69
|
velocity/misc/conv/__init__.py,sha256=qhHFl_UqW5tjPm--6shO171IysWIdH3mmp3uwiQVyqY,70
|
|
56
70
|
velocity/misc/conv/iconv.py,sha256=16aPWtreHCxmpl5ufku0KWWZj8PIUFI5J1dP0aXyM3o,10794
|
|
57
71
|
velocity/misc/conv/oconv.py,sha256=h5Lo05DqOQnxoD3y6Px_MQP_V-pBbWf8Hkgkb9Xp1jk,6032
|
|
58
|
-
velocity_python-0.0.
|
|
59
|
-
velocity_python-0.0.
|
|
60
|
-
velocity_python-0.0.
|
|
61
|
-
velocity_python-0.0.
|
|
62
|
-
velocity_python-0.0.
|
|
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,,
|