peewee Documentation Release 3.0.0Select queries Insert queries Update queries Delete queries More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd order_by(SQL('rank'), Member.surname, Member.firstname)) Find the top three revenue generating facilities Produce a list of the top three revenue generating facilities (including ties). Output facility (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation Release 3.4.0Insert queries Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd order_by(SQL('rank'), Member.surname, Member.firstname)) Find the top three revenue generating facilities Produce a list of the top three revenue generating facilities (including ties). Output facility (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0Insert queries Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd order_by(SQL('rank'), Member.surname, Member.firstname)) Find the top three revenue generating facilities Produce a list of the top three revenue generating facilities (including ties). Output facility (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.3.0order_by(SQL('rank'), Member.surname, Member.firstname)) Find the top three revenue generating facilities Produce a list of the top three revenue generating facilities (including ties). Output facility (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username queries in the wrapped block in a transaction. Warning: Calls to transaction cannot be nested. Only the top-most call will take effect. Rolling- back or committing a nested transaction context-manager has undefined0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0order_by(SQL('rank'), Member.surname, Member.firstname)) Find the top three revenue generating facilities Produce a list of the top three revenue generating facilities (including ties). Output facility (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username queries in the wrapped block in a transaction. Warning: Calls to transaction cannot be nested. Only the top-most call will take effect. Rolling- back or committing a nested transaction context-manager has undefined0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation Release 2.10.2Transaction, Savepoint and ExecutionContext Metadata Types Misc Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Note If you find any bugs, odd closed (or returned to the pool). @db.execution_context(with_transaction=False) def do_something(foo, bar): # When this function is called, a separate connection is made and will # be closed when (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation Release 3.6.0Insert queries Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Changes in 3.0 Backwards-incompatible consider the following query which uses multiple CTEs to find per-product sales totals in only the top sales regions. Our model looks like this: class Order(Model): region = TextField() amount = regional_sales AS ( SELECT region, SUM(amount) AS total_sales FROM orders GROUP BY region ), top_regions AS ( SELECT region FROM regional_sales WHERE total_sales > (SELECT SUM(total_sales)0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation
Release 3.5.0Insert queries Update queries Delete queries Query Objects More Hacks Optimistic Locking Top object per group Top N objects per group Writing custom functions with SQLite Changes in 3.0 Backwards-incompatible queries in the wrapped block in a transaction. Warning Calls to transaction cannot be nested. Only the top-most call will take effect. Rolling-back or committing a nested transaction context-manager has undefined database). query = (User .insert_many([{'username': 'foo'}, {'username': 'bar'}, {'username': 'baz'}]) .returning(User.id, User.username)0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation
Release 3.6.0consider the following query which uses multiple CTEs to find per-product sales totals in only the top sales regions. Our model looks like this: class Order(Model): region = TextField() amount = FloatField() WITH regional_sales AS ( SELECT region, SUM(amount) AS total_sales FROM orders GROUP BY region ), top_regions AS ( SELECT region FROM regional_sales WHERE total_sales > (SELECT SUM(total_sales) / 10 FROM SUM(quantity) AS product_units, SUM(amount) AS product_sales FROM orders WHERE region IN (SELECT region FROM top_regions) GROUP BY region, product; With Peewee, we would write: reg_sales = (Order .select(Order0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 2.10.2closed (or returned to the pool). @db.execution_context(with_transaction=False) def do_something(foo, bar): # When this function is called, a separate connection is made and will # be closed when the function (pipe) OR (User.is_admin) | (User.is_superuser) ~ NOT (unary negation) ~(User.username << ['foo', 'bar', 'baz']) Here is how you might use some of these query operators: # Find the user whose username need or None for an empty path: • path='' –> '$' • path='tags' –> '$.tags' • path='[0][1].bar' –> '$[0][1].bar' • path='metadata[0]' –> '$.metadata[0]' • path='user.data.email' –> '$.user.data.email'0 码力 | 221 页 | 844.06 KB | 1 年前3
共 16 条
- 1
- 2













