Python-SQL Abstraction Layer
When developing a (Web) application, you end up designing a layer,
where 90% of the SQL queries are very simple and the rest are really complex
and ugly, some even dynamically generated ones.
This package provides following capabilities:
- PostgreSQL support
- The module was tested with pyPgSQL. If you tried it with another module
and it does not work, tell me about it and i will try to fix it.
- Dynamic configuration on startup - reads tables, views, functions from DB,
optionally reads even table columns to provide better warning when trying
to access non-existent columns. If you have schema with many thousand
tables, you can disable even the basic schema loading,
so that the python code
does not hold all the table instances in memory.
- Easy queries look simple
- Hard queries look somewhat better than raw SQL, but in my opinion
raw SQL is still better understandable.
- Dynamically generated queries are EASY.
- Table/view inserts,select, update
- Calling of Postgres stored procedures
- inner/outer joins, union, intersect, except
- Subqueries (in the WHERE and FROM clause)
- 'Case' generated columns (automatic translation from python code)
- Automatic grouping operations
- Heavy operator overloading, so that the majority of operations can
be written directly in python code.
- Simple expression can be generated in one-line code - important for
web template languages
- Can generate SQL query with placeholders (%(name)s syntax)
The module, however, does not free you from learning SQL first.
Althouth the module does a lot of error checking,
it is possible to generate incorrect SQL queries. If you do not know
SQL, you will have problems debugging the code.
- Let's begin - simple selects
- What is select instance? Select,Delete,Update, limit, order
- Where are you? Conditions, automatic grouping
- Joins, subqueries, union, intersect, except
- 'Case' code transformation
- Database extending
the files and install it to python site-packages directory.
# python setup.py install