htablesA database library for storing mapping objects in a relational database | |
Download |
htables Ranking & Summary
Advertisement
- License:
- BSD License
- Price:
- FREE
- Publisher Name:
- Eau de Web
- Publisher web site:
- http://eaudeweb.ro
htables Tags
htables Description
HTables is a database Python library for storing mapping objects in a relational database. Two backends are supported so far: ~htables.PostgresqlDB (using the hstore extension; requires psycopg2) and ~htables.SQLiteDB.>>> import htables>>> db = htables.SqliteDB(':memory:')>>> session = db.get_session()>>> session.create_table()>>> session.commit()Tables are collections of Rows. A row is basically a dictionary with an extra id property. Its keys and values must be strings.>>> tweet_table = session>>> tweet = tweet_table.new(message="Hello world!")>>> tweet = '1337 h4x0r'>>> tweet.save()>>> session.commit()There are many ways of retrieving rows. The following all fetch the same record:>>> = list(tweet_table.find())>>> = list(tweet_table.find(author='1337 h4x0r'))>>> tweet = tweet_table.find_first()>>> tweet = tweet_table.find_single()>>> tweet = tweet_table.get(1)Product's homepage
htables Related Software