Skip to main content

Implements an easy-to-use bridge to SQLAlchemy

Project description

Example:

from solution import SQLALchemy

db = SQLALchemy('postgresql://scott:tiger@localhost:5432/mydatabase')

class ToDo(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(60), nullable=False)
    done = db.Column(db.Boolean, nullable=False, default=False)
    pub_date = db.Column(db.DateTime, nullable=False,
        default=datetime.utcnow)

to_do = ToDo(title='Install Solution', done=True)
db.add(to_do)
db.commit()

completed = db.query(ToDo).filter(ToDo.done == True).all()

It does an automatic table naming (if no name is defined) and, to the base query class, adds the following methods:

  • first_or_notfound

  • get_or_notfound

  • to_json

Project details


Release history Release notifications | RSS feed

This version

1.4

Download files

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

Source Distribution

Solution-1.4.tar.gz (148.3 kB view details)

Uploaded Source

File details

Details for the file Solution-1.4.tar.gz.

File metadata

  • Download URL: Solution-1.4.tar.gz
  • Upload date:
  • Size: 148.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Solution-1.4.tar.gz
Algorithm Hash digest
SHA256 cdd36abe7485ad563e1837cb7d88c4688292c380b63afe65d3dd77c8402f2f85
MD5 56e44e7a53119f27b37cc5409473a2cf
BLAKE2b-256 0b1b0ea9701d3bb7a3fac33e1cd8125a4fbdfba413ea6de75d39da2fd18f1f81

See more details on using hashes here.

Provenance

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