Skip to main content

SQLAlchemy to Django integration library

Project description

=======
Aldjemy
=======

Small package for integration SQLAlchemy into existent Django project.
Primarily use case of package is building complex queries that not possible
in Django ORM.

You need to include aldjemy to the end of `INSTALLED_APPS`. On models
importing aldjemy will read all models and contribute `sa` attribute to them.
`sa` attribute is a class, mapped to Table class.

Internally aldjemy generate tables from Django models. Its important distinction
from standart decision with reflection.

Code example:

User.sa.query(User.sa.username=='Brubeck')

Not so shiny example demonstrate that we have M2M issues now:

User.sa.query.join(User.sa.user_groups).join(User.sa.user_groups.property.mapper.class_.group).filter(Group.sa.name=="GROUP_NAME")

And we can do more better:

from aldjemy import core
U2G = core.Cache.models['auth_user_groups']
User.sa.query.join(U2G.user).join(U2G.group).filter(Group.sa.name=="GROUP_NAME").all()

Explicit joins is part of SQLAlchemy philosophy, so aldjemy cant get you Django expirience.
But aldjemy is not positioned as Django ORM drop-in replacement. Its helper for special situations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aldjemy-0.2.2.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file aldjemy-0.2.2.tar.gz.

File metadata

  • Download URL: aldjemy-0.2.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aldjemy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f9ba61bc378adaeec2e8fc3ee12e05a8d91c7f427647ed4cd814ec82fa3254c9
MD5 dfdbdf7e449c95923a43c3e09ea14a50
BLAKE2b-256 97a80e39ac6e14a6010ae5bbce5da22f1d4f1b5847bc417cf997ea9e729b4406

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page