velocity-python 0.0.64__tar.gz → 0.0.66__tar.gz
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_python-0.0.64 → velocity_python-0.0.66}/PKG-INFO +3 -2
- {velocity_python-0.0.64 → velocity_python-0.0.66}/pyproject.toml +1 -1
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/__init__.py +1 -1
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/engine.py +27 -21
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/tablehelper.py +5 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/PKG-INFO +3 -2
- {velocity_python-0.0.64 → velocity_python-0.0.66}/LICENSE +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/README.md +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/setup.cfg +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/context.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/lambda_handler.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/response.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/sqs_handler.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/column.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/database.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/decorators.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/exceptions.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/result.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/row.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/sequence.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/table.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/core/transaction.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/mysql.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/mysql_reserved.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/operators.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/reserved.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/sql.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/types.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlite.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlite_reserved.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlserver.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlserver_reserved.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/conv/__init__.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/conv/iconv.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/conv/oconv.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/db.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/export.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/format.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/mail.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/merge.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/misc/timer.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/SOURCES.txt +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/dependency_links.txt +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/requires.txt +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/top_level.txt +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_db.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_email_processing.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_format.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_iconv.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_merge.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_oconv.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_postgres.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_response.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_spreadsheet_functions.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_sql_builder.py +0 -0
- {velocity_python-0.0.64 → velocity_python-0.0.66}/tests/test_timer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: velocity-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.66
|
|
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
|
|
@@ -20,6 +20,7 @@ Provides-Extra: sqlserver
|
|
|
20
20
|
Requires-Dist: python-tds; extra == "sqlserver"
|
|
21
21
|
Provides-Extra: postgres
|
|
22
22
|
Requires-Dist: psycopg2-binary; extra == "postgres"
|
|
23
|
+
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
# Velocity.DB
|
|
25
26
|
|
|
@@ -57,6 +57,8 @@ class Engine:
|
|
|
57
57
|
May also be used to decorate a class, in which case all methods are wrapped in a transaction if they accept `tx`.
|
|
58
58
|
With no arguments, returns a new Transaction directly.
|
|
59
59
|
"""
|
|
60
|
+
# print("Transaction", func_or_cls.__name__, type(func_or_cls))
|
|
61
|
+
|
|
60
62
|
if func_or_cls is None:
|
|
61
63
|
return Transaction(self)
|
|
62
64
|
|
|
@@ -64,15 +66,21 @@ class Engine:
|
|
|
64
66
|
return classmethod(self.transaction(func_or_cls.__func__))
|
|
65
67
|
|
|
66
68
|
if inspect.isfunction(func_or_cls) or inspect.ismethod(func_or_cls):
|
|
69
|
+
names = list(inspect.signature(func_or_cls).parameters.keys())
|
|
70
|
+
# print(func_or_cls.__name__, names)
|
|
71
|
+
if "_tx" in names:
|
|
72
|
+
raise NameError(
|
|
73
|
+
f"In function {func_or_cls.__name__}, '_tx' is not allowed as a parameter."
|
|
74
|
+
)
|
|
67
75
|
|
|
68
76
|
@wraps(func_or_cls)
|
|
69
77
|
def new_function(*args, **kwds):
|
|
70
78
|
tx = None
|
|
71
79
|
names = list(inspect.signature(func_or_cls).parameters.keys())
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
|
|
81
|
+
# print("inside", func_or_cls.__name__)
|
|
82
|
+
# print(names)
|
|
83
|
+
# print(args, kwds)
|
|
76
84
|
|
|
77
85
|
if "tx" not in names:
|
|
78
86
|
# The function doesn't even declare a `tx` parameter, so run normally.
|
|
@@ -91,33 +99,31 @@ class Engine:
|
|
|
91
99
|
if len(args) > pos:
|
|
92
100
|
if isinstance(args[pos], Transaction):
|
|
93
101
|
tx = args[pos]
|
|
94
|
-
|
|
95
|
-
raise TypeError(
|
|
96
|
-
f"In function {func_or_cls.__name__}, positional argument `tx` must be a Transaction object."
|
|
97
|
-
)
|
|
102
|
+
|
|
98
103
|
if tx:
|
|
99
104
|
return self.exec_function(func_or_cls, tx, *args, **kwds)
|
|
105
|
+
|
|
100
106
|
with Transaction(self) as local_tx:
|
|
101
107
|
pos = names.index("tx")
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
args = tuple(args)
|
|
105
|
-
return self.exec_function(func_or_cls, local_tx, *args, **kwds)
|
|
108
|
+
new_args = args[:pos] + (local_tx,) + args[pos:]
|
|
109
|
+
return self.exec_function(func_or_cls, local_tx, *new_args, **kwds)
|
|
106
110
|
|
|
107
111
|
return new_function
|
|
108
112
|
|
|
109
113
|
if inspect.isclass(func_or_cls):
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
NewCls = type(func_or_cls.__name__, (func_or_cls,), {})
|
|
116
|
+
|
|
117
|
+
for attr_name in dir(func_or_cls):
|
|
118
|
+
# Optionally skip special methods
|
|
119
|
+
if attr_name.startswith("__") and attr_name.endswith("__"):
|
|
120
|
+
continue
|
|
121
|
+
|
|
122
|
+
attr = getattr(func_or_cls, attr_name)
|
|
123
|
+
|
|
124
|
+
if callable(attr):
|
|
125
|
+
setattr(NewCls, attr_name, self.transaction(attr))
|
|
113
126
|
|
|
114
|
-
for attr_name, attr_value in func_or_cls.__dict__.items():
|
|
115
|
-
if (
|
|
116
|
-
isinstance(attr_value, classmethod)
|
|
117
|
-
or inspect.isfunction(attr_value)
|
|
118
|
-
or inspect.ismethod(attr_value)
|
|
119
|
-
):
|
|
120
|
-
setattr(NewCls, attr_name, self.transaction(attr_value))
|
|
121
127
|
return NewCls
|
|
122
128
|
|
|
123
129
|
return Transaction(self)
|
|
@@ -144,6 +144,11 @@ class TableHelper:
|
|
|
144
144
|
Extracts the 'bare' column name from an expression, ignoring function calls, operators, etc.
|
|
145
145
|
"""
|
|
146
146
|
expr = sql_expression.replace('"', "")
|
|
147
|
+
|
|
148
|
+
# Remove any alias part (e.g., "as num_donors").
|
|
149
|
+
# This regex removes any trailing alias defined using "as".
|
|
150
|
+
expr = re.sub(r"(?i)\s+as\s+\w+$", "", expr).strip()
|
|
151
|
+
|
|
147
152
|
expr = self.remove_operator(expr)
|
|
148
153
|
if not self.are_parentheses_balanced(expr):
|
|
149
154
|
raise ValueError(f"Unbalanced parentheses in expression: {expr}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: velocity-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.66
|
|
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
|
|
@@ -20,6 +20,7 @@ Provides-Extra: sqlserver
|
|
|
20
20
|
Requires-Dist: python-tds; extra == "sqlserver"
|
|
21
21
|
Provides-Extra: postgres
|
|
22
22
|
Requires-Dist: psycopg2-binary; extra == "postgres"
|
|
23
|
+
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
# Velocity.DB
|
|
25
26
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/aws/handlers/lambda_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/__init__.py
RENAMED
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/operators.py
RENAMED
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/postgres/reserved.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlite_reserved.py
RENAMED
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity/db/servers/sqlserver_reserved.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.64 → velocity_python-0.0.66}/src/velocity_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|