Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

A SQLAlchemy wrapper that stays out of your way

Project Description

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('pgsql://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
Release History

Release History

History Node

1.0.3-rc1

This version
History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rowhouse-1.0.2.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source May 13, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting