sqltemplate
Database query tool based on SQL templates
Development status
- Alpha
- API may be radically changed until first Beta release
- Not tested automatically yet
Roadmap
- 0.6 - drop django-sqltemplate compatibility layer
- 0.7 - automated tests, first beta release
- 0.8 - stable API
- 0.9,<1.0 - minor improvements without API changes, bugfixes
- 1.0 - first stable release
Introduction
SQL is a great and poweruful DSL, which is easeier in maintenance when you're working on complext queries (i.e. reporting queries). But the main problem of raw SQL is a commonly used "spaghetti" anti-pattern, when you're embedding/building SQLs directly in your code.
The solution comes from templating SQLs idea and sqltemplate
is a simple implementation of it.
Template system / database agnostic
The sqltemplate provides an abstraction layer for templating SQL
queries and working with query results. It requires an adapter to work.
For example - if you want to use sqltemplate together with Django
templates and database management, use django-sqltemplate adapter
directly.
Backward compatibilty with django-template
The 0.5.x branch contains a compatibility layer with django-template.
The layer provides Django adapter and necessary imports.
Building an adapter
Adapter must implement few callables required by sqltemplate core.
The adapter may be as a class instance or pure Python module providing
such functions. These functions are defined as:
load_template(template_name)
Must load template by name and return some kind of template object,
which will be passed to render_template() as an argument.
create_template_from_string(string)
Creates template object from provided string.
render_template(template, context)
Must render the template object using provided context (a dict).
do_query(sql, query_params, using=None)
Must execute a sql query with query_params applied.
Optional using argument specifies database connection identifier.
This may be any object dependent on how your adapter recognizes
particular connections. For Django adapter, for example, this is a
string with a connection name.
Dependencies
- sqlparse
- flatdict
License
BSD
Metadata
Release files for sqltemplate 0.5.4.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqltemplate-0.5.4.post1.tar.gz | 8.5 kB | Without provenance | Details for sqltemplate-0.5.4.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqltemplate-0.5.4.post1-py3-none-any.whl | Python 3 | none | any | Details for sqltemplate-0.5.4.post1-py3-none-any.whl |
Total release size: 19.3 kB
Release files / sqltemplate-0.5.4.post1.tar.gz
| Download URL | sqltemplate-0.5.4.post1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
684bf0253a6b88b0e651394932872e213416b19cace161563a64b0b9c9c0ff52
|
|
BLAKE2b-256 checksum How to use checksums |
a67fa16b04b4dc379f91b2bc7852c6e17ac5eb8d71a21000db889b94b67addb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.8.0
|
Release files / sqltemplate-0.5.4.post1-py3-none-any.whl
| Download URL | sqltemplate-0.5.4.post1-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a95cbd9be8a5a3d1daa8383e424b0da946fb51d729a8c78800e9166d328dc6b7
|
|
BLAKE2b-256 checksum How to use checksums |
f6d38f567956106790269d748947e7ab01e1dcea55dcc9c44c97ac1809130d2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.8.0
|
Security for sqltemplate 0.5.4.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.