Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

version Build status of master branch

For when you just want to write SQL

Rowhouse is a SQLAlchemy wrapper that attempts to strike a happy medium between using raw database bindings like psycopg2 and using the full SQLAlchemy API.

Use it when:

  • You don’t want to mess with connections, cursors, sessions, etc

  • You don’t need or want an ORM or repository

  • You don’t want to look up SQLAlchemy’s expression language every time you need a non-trivial query

  • You just want to write some SQL, and work with plain old dicts and lists

  • You want some convenient helper functions for common operations

Install

pip install rowhouse

Basic Usage

from rowhouse import Connection
db = Connnection('postgresql://localhost/mydatabase')

# Run some SQL
row = db.fetchone('SELECT * FROM users WHERE username = %s', ('mreynolds',))
print('Name = ' + row['fullname'])

for row in db.fetchiter('SELECT * FROM users'):
    print('User: ' + row['fullname'])

db.begin()
db.execute('CREATE TABLE groups (...)')
db.execute('INSERT INTO groups VALUES (%s, %s)', ('firefly', 'mreynolds'))
db.commit()

# Some convenient helpers
with db.transaction():
    row = db.findone('users', username='mreynolds')
    db.update('users', {
        'role': 'captain'
    }, id=row['id'])
    newrow = db.insert('users', {
        'fullname': 'Zoe Washburne',
        'username': 'zwashburne',
        'role': 'first_mate'
    })

To Do

  • [x] Implement find* methods

  • [x] Implement insert/update/delete/upsert methods

  • [x] Add tests and CI

  • [x] Add packaging and publish to pypi

  • [ ] More configurability - constructor, setters, etc

  • [ ] Simple model support - little more than classes with a Connection baked in and some convenience methods

Download files

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

Source Distribution

rowhouse-1.0.3-rc1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file rowhouse-1.0.3-rc1.tar.gz.

File metadata

  • Download URL: rowhouse-1.0.3-rc1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rowhouse-1.0.3-rc1.tar.gz
Algorithm Hash digest
SHA256 a49f9fe33ad500af9c3f1ee50cd7b8afd832c7ccb136c7060a974e86a0f3c7fe
MD5 d9c77bf20a852491954d93b64ac14763
BLAKE2b-256 5602eaee8a2f3a3fd90ce2333e138542b109812b607d1dba638b66853865ab6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page