python-python-sql
Port variant v13
Summary Library to write SQL queries (3.13)
BROKEN
Package version 1.5.2
Homepage https://pypi.org/project/python-sql/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 NOV 2024, 16:08:50 UTC
Port created 22 OCT 2023, 16:37:00 UTC
Subpackage Descriptions
single python-sql ========== python-sql is a library to write SQL queries in a pythonic way. Nutshell -------- Import:: >>> from sql import * >>> from sql.aggregate import * >>> from sql.conditionals import * Simple selects:: >>> user = Table('user') >>> select = user.select() >>> tuple(select) ('SELECT * FROM "user" AS "a"', ()) >>> select = user.select(user.name) >>> tuple(select) ('SELECT "a"."name" FROM "user" AS "a"', ()) >>> select = user.select(Count(Literal(1))) >>> tuple(select) ('SELECT COUNT(%s) FROM "user" AS "a"', (1,)) >>> select = user.select(user.name, distinct=True) >>> tuple(select) ('SELECT DISTINCT "a"."name" FROM "user" AS "a"', ()) >>> select = user.select(user.id, user.name) >>> tuple(select) ('SELECT "a"."id", "a"."name" FROM "user" AS "a"', ()) Select with where condition:: >>> select.where = user.name == 'foo' >>> tuple(select) ('SELECT "a"."id", "a"."name" FROM "user" AS "a" WHERE ("a"."name" = %s)', ('foo',)) >>> select.where = (user.name == 'foo') & (user.active == True) >>> tuple(select) ('SELECT "a"."id", "a"."name" FROM "user" AS "a" WHERE (("a"."name" = %s) AND ("a"."active" = %s))', ('foo', True)) >>> select.where = user.name == user.login >>> tuple(select) ('SELECT "a"."id", "a"."name" FROM "user" AS "a" WHERE ("a"."name" = "a"."login")', ()) Select with join:: >>> join = user.join(Table('user_group')) >>> join.condition = join.right.user == user.id >>> select = join.select(user.name, join.right.group) >>> tuple(select) ('SELECT "a"."name", "b"."group" FROM "user" AS "a" INNER JOIN "user_group" AS "b" ON ("b"."user" = "a"."id")', ()) Select with multiple joins:: >>> join1 = user.join(Table('user')) >>> join2 = join1.join(Table('user')) >>> select = join2.select(user.id, join1.right.id, join2.right.id) >>> tuple(select) ('SELECT "a"."id", "b"."id", "c"."id" FROM "user" AS "a" INNER JOIN "user" AS "b" INNER JOIN "user" AS "c"', ()) Select with group_by:: >>> invoice = Table('invoice') >>> select = invoice.select(Sum(invoice.amount), invoice.currency, ... group_by=invoice.currency) >>> tuple(select) ('SELECT SUM("a"."amount"), "a"."currency" FROM "invoice" AS "a" GROUP BY "a"."currency"', ()) Select with output name:: >>> tuple(user.select(user.name.as_('First Name'))) ('SELECT "a"."name" AS "First Name" FROM "user" AS "a"', ()) Select with order_by:: >>> tuple(user.select(order_by=user.date)) ('SELECT * FROM "user" AS "a" ORDER BY "a"."date"', ()) >>> tuple(user.select(order_by=Asc(user.date))) ('SELECT * FROM "user" AS "a" ORDER BY "a"."date" ASC', ()) >>> tuple(user.select(order_by=(user.date.asc, user.id.desc))) ('SELECT * FROM "user" AS "a" ORDER BY "a"."date" ASC, "a"."id" DESC', ()) Select with sub-select:: >>> user_group = Table('user_group') >>> subselect = user_group.select(user_group.user, ... where=user_group.active == True)
Configuration Switches (platform-specific settings discarded)
PY312 OFF Build using Python 3.12 PY313 ON Build using Python 3.13
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Download groups
main mirror://PYPIWHL/94/88/464585e29cd8531c43e58fd69db51da9abb8bc30f15e47bd6b451770123a
Distribution File Information
8374b3b898c174c353f97ca0315c7cf5b9dcd2de58d780cf4a0a2c80085ee762 48809 python-src/python_sql-1.5.2-py3-none-any.whl
Ports that require python-python-sql:v13
python-trytond-account-asset:v13 Tryton module for assets management (3.13)
python-trytond-account-invoice:v13 Tryton module for invoicing (3.13)
python-trytond-account:v13 Tryton module for accounting (3.13)
python-trytond-company:v13 Tryton module with companies and employees (3.13)
python-trytond-country:v13 Tryton module with countries (3.13)
python-trytond-currency:v13 Tryton module with currencies (3.13)
python-trytond-party:v13 Tryton module with parties and addresses (3.13)
python-trytond-product:v13 Tryton module with products (3.13)
python-trytond-purchase:v13 Tryton module for purchase (3.13)
python-trytond-stock:v13 Tryton module for stock and inventory (3.13)
python-trytond:v13 Tryton server (3.13)