python-sql 1.5.2__tar.gz → 1.6.0__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.
- {python_sql-1.5.2 → python_sql-1.6.0}/.gitlab-ci.yml +1 -1
- {python_sql-1.5.2 → python_sql-1.6.0}/.hgtags +1 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/CHANGELOG +5 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/COPYRIGHT +3 -3
- {python_sql-1.5.2 → python_sql-1.6.0}/PKG-INFO +23 -11
- {python_sql-1.5.2 → python_sql-1.6.0}/README.rst +9 -9
- {python_sql-1.5.2 → python_sql-1.6.0}/python_sql.egg-info/PKG-INFO +23 -11
- {python_sql-1.5.2 → python_sql-1.6.0}/setup.py +1 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/__init__.py +9 -8
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/__init__.py +1 -1
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_select.py +13 -3
- {python_sql-1.5.2 → python_sql-1.6.0}/tox.ini +1 -1
- {python_sql-1.5.2 → python_sql-1.6.0}/.flake8 +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/.isort.cfg +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/MANIFEST.in +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/python_sql.egg-info/SOURCES.txt +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/python_sql.egg-info/dependency_links.txt +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/python_sql.egg-info/top_level.txt +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/setup.cfg +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/aggregate.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/conditionals.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/functions.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/operators.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_aggregate.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_alias.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_as.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_cast.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_collate.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_column.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_combining_query.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_conditionals.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_delete.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_excluded.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_expression.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_flavor.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_for.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_from.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_from_item.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_functions.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_grouping.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_insert.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_join.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_lateral.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_literal.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_merge.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_operators.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_order.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_rollup.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_table.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_update.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_values.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_window.py +0 -0
- {python_sql-1.5.2 → python_sql-1.6.0}/sql/tests/test_with.py +0 -0
|
@@ -57,7 +57,7 @@ test-tox-python:
|
|
|
57
57
|
- tox -e "py${PYTHON_VERSION/./}" -- -v --output-file junit.xml
|
|
58
58
|
parallel:
|
|
59
59
|
matrix:
|
|
60
|
-
- PYTHON_VERSION: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
60
|
+
- PYTHON_VERSION: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
61
61
|
|
|
62
62
|
test-tox-pypy:
|
|
63
63
|
extends: .test-tox
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
Version 1.6.0 - 2025-05-02
|
|
2
|
+
* Fix position of order_by parameters in Select query
|
|
3
|
+
* Add support for weak reference on SQL objects
|
|
4
|
+
* Add support for Python 3.13
|
|
5
|
+
|
|
1
6
|
Version 1.5.2 - 2024-09-30
|
|
2
7
|
* Use parameter for unary operator
|
|
3
8
|
* Support default values when inserting not matched merge
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Copyright (c) 2011-
|
|
2
|
-
Copyright (c) 2013-
|
|
3
|
-
Copyright (c) 2011-
|
|
1
|
+
Copyright (c) 2011-2025, Cédric Krier
|
|
2
|
+
Copyright (c) 2013-2025, Nicolas Évrard
|
|
3
|
+
Copyright (c) 2011-2025, B2CK
|
|
4
4
|
All rights reserved.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-sql
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: Library to write SQL queries
|
|
5
5
|
Home-page: https://pypi.org/project/python-sql/
|
|
6
6
|
Download-URL: https://downloads.tryton.org/python-sql/
|
|
@@ -24,9 +24,21 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
25
|
Classifier: Programming Language :: Python :: 3.11
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
28
|
Classifier: Topic :: Database
|
|
28
29
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
30
|
Requires-Python: >=3.5
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: download-url
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: license
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
30
42
|
|
|
31
43
|
python-sql
|
|
32
44
|
==========
|
|
@@ -136,23 +148,23 @@ Select on other schema::
|
|
|
136
148
|
Insert query with default values::
|
|
137
149
|
|
|
138
150
|
>>> tuple(user.insert())
|
|
139
|
-
('INSERT INTO "user"
|
|
151
|
+
('INSERT INTO "user" DEFAULT VALUES', ())
|
|
140
152
|
|
|
141
153
|
Insert query with values::
|
|
142
154
|
|
|
143
155
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
144
156
|
... values=[['Foo', 'foo']]))
|
|
145
|
-
('INSERT INTO "user"
|
|
157
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s)', ('Foo', 'foo'))
|
|
146
158
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
147
159
|
... values=[['Foo', 'foo'], ['Bar', 'bar']]))
|
|
148
|
-
('INSERT INTO "user"
|
|
160
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s), (%s, %s)', ('Foo', 'foo', 'Bar', 'bar'))
|
|
149
161
|
|
|
150
162
|
Insert query with query::
|
|
151
163
|
|
|
152
164
|
>>> passwd = Table('passwd')
|
|
153
165
|
>>> select = passwd.select(passwd.login, passwd.passwd)
|
|
154
166
|
>>> tuple(user.insert(values=select))
|
|
155
|
-
('INSERT INTO "user"
|
|
167
|
+
('INSERT INTO "user" SELECT "a"."login", "a"."passwd" FROM "passwd" AS "a"', ())
|
|
156
168
|
|
|
157
169
|
Update query with values::
|
|
158
170
|
|
|
@@ -196,23 +208,23 @@ Flavors::
|
|
|
196
208
|
>>> select.offset = 10
|
|
197
209
|
>>> Flavor.set(Flavor())
|
|
198
210
|
>>> tuple(select)
|
|
199
|
-
('SELECT * FROM "user" AS "a" OFFSET
|
|
211
|
+
('SELECT * FROM "user" AS "a" OFFSET %s', (10,))
|
|
200
212
|
>>> Flavor.set(Flavor(max_limit=18446744073709551615))
|
|
201
213
|
>>> tuple(select)
|
|
202
|
-
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET
|
|
214
|
+
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET %s', (10,))
|
|
203
215
|
>>> Flavor.set(Flavor(max_limit=-1))
|
|
204
216
|
>>> tuple(select)
|
|
205
|
-
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET
|
|
217
|
+
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET %s', (10,))
|
|
206
218
|
|
|
207
219
|
Limit style::
|
|
208
220
|
|
|
209
221
|
>>> select = user.select(limit=10, offset=20)
|
|
210
222
|
>>> Flavor.set(Flavor(limitstyle='limit'))
|
|
211
223
|
>>> tuple(select)
|
|
212
|
-
('SELECT * FROM "user" AS "a" LIMIT
|
|
224
|
+
('SELECT * FROM "user" AS "a" LIMIT %s OFFSET %s', (10, 20))
|
|
213
225
|
>>> Flavor.set(Flavor(limitstyle='fetch'))
|
|
214
226
|
>>> tuple(select)
|
|
215
|
-
('SELECT * FROM "user" AS "a" OFFSET (
|
|
227
|
+
('SELECT * FROM "user" AS "a" OFFSET (%s) ROWS FETCH FIRST (%s) ROWS ONLY', (20, 10))
|
|
216
228
|
>>> Flavor.set(Flavor(limitstyle='rownum'))
|
|
217
229
|
>>> tuple(select)
|
|
218
230
|
('SELECT "a".* FROM (SELECT "b".*, ROWNUM AS "rnum" FROM (SELECT * FROM "user" AS "c") AS "b" WHERE (ROWNUM <= %s)) AS "a" WHERE ("rnum" > %s)', (30, 20))
|
|
@@ -106,23 +106,23 @@ Select on other schema::
|
|
|
106
106
|
Insert query with default values::
|
|
107
107
|
|
|
108
108
|
>>> tuple(user.insert())
|
|
109
|
-
('INSERT INTO "user"
|
|
109
|
+
('INSERT INTO "user" DEFAULT VALUES', ())
|
|
110
110
|
|
|
111
111
|
Insert query with values::
|
|
112
112
|
|
|
113
113
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
114
114
|
... values=[['Foo', 'foo']]))
|
|
115
|
-
('INSERT INTO "user"
|
|
115
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s)', ('Foo', 'foo'))
|
|
116
116
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
117
117
|
... values=[['Foo', 'foo'], ['Bar', 'bar']]))
|
|
118
|
-
('INSERT INTO "user"
|
|
118
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s), (%s, %s)', ('Foo', 'foo', 'Bar', 'bar'))
|
|
119
119
|
|
|
120
120
|
Insert query with query::
|
|
121
121
|
|
|
122
122
|
>>> passwd = Table('passwd')
|
|
123
123
|
>>> select = passwd.select(passwd.login, passwd.passwd)
|
|
124
124
|
>>> tuple(user.insert(values=select))
|
|
125
|
-
('INSERT INTO "user"
|
|
125
|
+
('INSERT INTO "user" SELECT "a"."login", "a"."passwd" FROM "passwd" AS "a"', ())
|
|
126
126
|
|
|
127
127
|
Update query with values::
|
|
128
128
|
|
|
@@ -166,23 +166,23 @@ Flavors::
|
|
|
166
166
|
>>> select.offset = 10
|
|
167
167
|
>>> Flavor.set(Flavor())
|
|
168
168
|
>>> tuple(select)
|
|
169
|
-
('SELECT * FROM "user" AS "a" OFFSET
|
|
169
|
+
('SELECT * FROM "user" AS "a" OFFSET %s', (10,))
|
|
170
170
|
>>> Flavor.set(Flavor(max_limit=18446744073709551615))
|
|
171
171
|
>>> tuple(select)
|
|
172
|
-
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET
|
|
172
|
+
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET %s', (10,))
|
|
173
173
|
>>> Flavor.set(Flavor(max_limit=-1))
|
|
174
174
|
>>> tuple(select)
|
|
175
|
-
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET
|
|
175
|
+
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET %s', (10,))
|
|
176
176
|
|
|
177
177
|
Limit style::
|
|
178
178
|
|
|
179
179
|
>>> select = user.select(limit=10, offset=20)
|
|
180
180
|
>>> Flavor.set(Flavor(limitstyle='limit'))
|
|
181
181
|
>>> tuple(select)
|
|
182
|
-
('SELECT * FROM "user" AS "a" LIMIT
|
|
182
|
+
('SELECT * FROM "user" AS "a" LIMIT %s OFFSET %s', (10, 20))
|
|
183
183
|
>>> Flavor.set(Flavor(limitstyle='fetch'))
|
|
184
184
|
>>> tuple(select)
|
|
185
|
-
('SELECT * FROM "user" AS "a" OFFSET (
|
|
185
|
+
('SELECT * FROM "user" AS "a" OFFSET (%s) ROWS FETCH FIRST (%s) ROWS ONLY', (20, 10))
|
|
186
186
|
>>> Flavor.set(Flavor(limitstyle='rownum'))
|
|
187
187
|
>>> tuple(select)
|
|
188
188
|
('SELECT "a".* FROM (SELECT "b".*, ROWNUM AS "rnum" FROM (SELECT * FROM "user" AS "c") AS "b" WHERE (ROWNUM <= %s)) AS "a" WHERE ("rnum" > %s)', (30, 20))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-sql
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: Library to write SQL queries
|
|
5
5
|
Home-page: https://pypi.org/project/python-sql/
|
|
6
6
|
Download-URL: https://downloads.tryton.org/python-sql/
|
|
@@ -24,9 +24,21 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
25
|
Classifier: Programming Language :: Python :: 3.11
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
28
|
Classifier: Topic :: Database
|
|
28
29
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
30
|
Requires-Python: >=3.5
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: download-url
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: license
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
30
42
|
|
|
31
43
|
python-sql
|
|
32
44
|
==========
|
|
@@ -136,23 +148,23 @@ Select on other schema::
|
|
|
136
148
|
Insert query with default values::
|
|
137
149
|
|
|
138
150
|
>>> tuple(user.insert())
|
|
139
|
-
('INSERT INTO "user"
|
|
151
|
+
('INSERT INTO "user" DEFAULT VALUES', ())
|
|
140
152
|
|
|
141
153
|
Insert query with values::
|
|
142
154
|
|
|
143
155
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
144
156
|
... values=[['Foo', 'foo']]))
|
|
145
|
-
('INSERT INTO "user"
|
|
157
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s)', ('Foo', 'foo'))
|
|
146
158
|
>>> tuple(user.insert(columns=[user.name, user.login],
|
|
147
159
|
... values=[['Foo', 'foo'], ['Bar', 'bar']]))
|
|
148
|
-
('INSERT INTO "user"
|
|
160
|
+
('INSERT INTO "user" ("name", "login") VALUES (%s, %s), (%s, %s)', ('Foo', 'foo', 'Bar', 'bar'))
|
|
149
161
|
|
|
150
162
|
Insert query with query::
|
|
151
163
|
|
|
152
164
|
>>> passwd = Table('passwd')
|
|
153
165
|
>>> select = passwd.select(passwd.login, passwd.passwd)
|
|
154
166
|
>>> tuple(user.insert(values=select))
|
|
155
|
-
('INSERT INTO "user"
|
|
167
|
+
('INSERT INTO "user" SELECT "a"."login", "a"."passwd" FROM "passwd" AS "a"', ())
|
|
156
168
|
|
|
157
169
|
Update query with values::
|
|
158
170
|
|
|
@@ -196,23 +208,23 @@ Flavors::
|
|
|
196
208
|
>>> select.offset = 10
|
|
197
209
|
>>> Flavor.set(Flavor())
|
|
198
210
|
>>> tuple(select)
|
|
199
|
-
('SELECT * FROM "user" AS "a" OFFSET
|
|
211
|
+
('SELECT * FROM "user" AS "a" OFFSET %s', (10,))
|
|
200
212
|
>>> Flavor.set(Flavor(max_limit=18446744073709551615))
|
|
201
213
|
>>> tuple(select)
|
|
202
|
-
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET
|
|
214
|
+
('SELECT * FROM "user" AS "a" LIMIT 18446744073709551615 OFFSET %s', (10,))
|
|
203
215
|
>>> Flavor.set(Flavor(max_limit=-1))
|
|
204
216
|
>>> tuple(select)
|
|
205
|
-
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET
|
|
217
|
+
('SELECT * FROM "user" AS "a" LIMIT -1 OFFSET %s', (10,))
|
|
206
218
|
|
|
207
219
|
Limit style::
|
|
208
220
|
|
|
209
221
|
>>> select = user.select(limit=10, offset=20)
|
|
210
222
|
>>> Flavor.set(Flavor(limitstyle='limit'))
|
|
211
223
|
>>> tuple(select)
|
|
212
|
-
('SELECT * FROM "user" AS "a" LIMIT
|
|
224
|
+
('SELECT * FROM "user" AS "a" LIMIT %s OFFSET %s', (10, 20))
|
|
213
225
|
>>> Flavor.set(Flavor(limitstyle='fetch'))
|
|
214
226
|
>>> tuple(select)
|
|
215
|
-
('SELECT * FROM "user" AS "a" OFFSET (
|
|
227
|
+
('SELECT * FROM "user" AS "a" OFFSET (%s) ROWS FETCH FIRST (%s) ROWS ONLY', (20, 10))
|
|
216
228
|
>>> Flavor.set(Flavor(limitstyle='rownum'))
|
|
217
229
|
>>> tuple(select)
|
|
218
230
|
('SELECT "a".* FROM (SELECT "b".*, ROWNUM AS "rnum" FROM (SELECT * FROM "user" AS "c") AS "b" WHERE (ROWNUM <= %s)) AS "a" WHERE ("rnum" > %s)', (30, 20))
|
|
@@ -48,6 +48,7 @@ setup(name='python-sql',
|
|
|
48
48
|
'Programming Language :: Python :: 3.10',
|
|
49
49
|
'Programming Language :: Python :: 3.11',
|
|
50
50
|
'Programming Language :: Python :: 3.12',
|
|
51
|
+
'Programming Language :: Python :: 3.13',
|
|
51
52
|
'Topic :: Database',
|
|
52
53
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
53
54
|
],
|
|
@@ -7,7 +7,7 @@ from collections import defaultdict
|
|
|
7
7
|
from itertools import chain
|
|
8
8
|
from threading import current_thread, local
|
|
9
9
|
|
|
10
|
-
__version__ = '1.
|
|
10
|
+
__version__ = '1.6.0'
|
|
11
11
|
__all__ = [
|
|
12
12
|
'Flavor', 'Table', 'Values', 'Literal', 'Column', 'Grouping', 'Conflict',
|
|
13
13
|
'Matched', 'MatchedUpdate', 'MatchedDelete',
|
|
@@ -182,7 +182,7 @@ def format2numeric(query, params):
|
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
class Query(object):
|
|
185
|
-
__slots__ = ()
|
|
185
|
+
__slots__ = ('__weakref__',)
|
|
186
186
|
|
|
187
187
|
@property
|
|
188
188
|
def params(self):
|
|
@@ -243,7 +243,7 @@ class WithQuery(Query):
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
class FromItem(object):
|
|
246
|
-
__slots__ = ()
|
|
246
|
+
__slots__ = ('__weakref__',)
|
|
247
247
|
|
|
248
248
|
@property
|
|
249
249
|
def alias(self):
|
|
@@ -692,13 +692,13 @@ class Select(FromItem, SelectQuery):
|
|
|
692
692
|
if self.group_by:
|
|
693
693
|
for expression in self.group_by:
|
|
694
694
|
p.extend(expression.params)
|
|
695
|
-
if self.order_by:
|
|
696
|
-
for expression in self.order_by:
|
|
697
|
-
p.extend(expression.params)
|
|
698
695
|
if self.having:
|
|
699
696
|
p.extend(self.having.params)
|
|
700
697
|
for window in self.windows:
|
|
701
698
|
p.extend(window.params)
|
|
699
|
+
if self.order_by:
|
|
700
|
+
for expression in self.order_by:
|
|
701
|
+
p.extend(expression.params)
|
|
702
702
|
p.extend(self._limit_offset_params)
|
|
703
703
|
return tuple(p)
|
|
704
704
|
|
|
@@ -1615,7 +1615,7 @@ class Values(list, Query, FromItem):
|
|
|
1615
1615
|
|
|
1616
1616
|
|
|
1617
1617
|
class Expression(object):
|
|
1618
|
-
__slots__ = ()
|
|
1618
|
+
__slots__ = ('__weakref__',)
|
|
1619
1619
|
|
|
1620
1620
|
def __str__(self):
|
|
1621
1621
|
raise NotImplementedError
|
|
@@ -1986,7 +1986,8 @@ class Cube(Rollup):
|
|
|
1986
1986
|
|
|
1987
1987
|
class Window(object):
|
|
1988
1988
|
__slots__ = (
|
|
1989
|
-
'_partition', '_order_by', '_frame', '_start', '_end', '_exclude'
|
|
1989
|
+
'_partition', '_order_by', '_frame', '_start', '_end', '_exclude',
|
|
1990
|
+
'__weakref__')
|
|
1990
1991
|
|
|
1991
1992
|
def __init__(self, partition, order_by=None,
|
|
1992
1993
|
frame=None, start=None, end=0, exclude=None):
|
|
@@ -531,14 +531,24 @@ class TestSelect(unittest.TestCase):
|
|
|
531
531
|
def test_order_params(self):
|
|
532
532
|
with_ = With(query=self.table.select(self.table.c,
|
|
533
533
|
where=(self.table.c > 1)))
|
|
534
|
-
w = Window([Literal(
|
|
534
|
+
w = Window([Literal(7)])
|
|
535
535
|
query = Select([Literal(2), Min(self.table.c, window=w)],
|
|
536
536
|
from_=self.table.select(where=self.table.c > 3),
|
|
537
537
|
with_=with_,
|
|
538
538
|
where=self.table.c > 4,
|
|
539
539
|
group_by=[Literal(5)],
|
|
540
|
-
|
|
541
|
-
|
|
540
|
+
having=Literal(6),
|
|
541
|
+
order_by=[Literal(8)])
|
|
542
|
+
self.assertEqual(
|
|
543
|
+
str(query),
|
|
544
|
+
'WITH "c" AS (SELECT "a"."c" FROM "t" AS "a" WHERE ("a"."c" > %s))'
|
|
545
|
+
' SELECT %s, MIN("a"."c") OVER "b" '
|
|
546
|
+
'FROM SELECT * FROM "t" AS "a" WHERE ("a"."c" > %s) '
|
|
547
|
+
'WHERE ("a"."c" > %s) '
|
|
548
|
+
'GROUP BY %s '
|
|
549
|
+
'HAVING %s '
|
|
550
|
+
'WINDOW "b" AS (PARTITION BY %s) '
|
|
551
|
+
'ORDER BY %s')
|
|
542
552
|
self.assertEqual(tuple(query.params), (1, 2, 3, 4, 5, 6, 7, 8))
|
|
543
553
|
|
|
544
554
|
def test_no_as(self):
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|