Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .heroku
Octocat-spinner-32 app
Octocat-spinner-32 demo
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.rst
Octocat-spinner-32 manage.py
Octocat-spinner-32 requirements.txt
README.rst

Schemaless SQL

Setup

git clone https://github.com/craigkerstiens/hstore-demo.git
heroku create -s cedar
git push heroku master
heroku addons:remove shared-database
heroku addons:add heroku-postgresql:dev
heroku pg:promote HEROKU_POSTGRESQL_COLORGOESHEERE

Then connect to your database with 'heroku pg:psql' and create the hstore extension

create extension hstore;

Finally sync your database

heroku run python manage.py syncdb

Example Uses

from app.models import *
django_pony = Product.objects.create(name='Django Pony', data={'rating': '5'})
pink_pony = Product.objects.create(name='Pony', data={'color': 'pink', 'rating': '4'})

colored_ponies = Product.objects.filter(data__contains='color')
print colored_ponies[0]
print colored_ponies[0].data
print colored_ponies[0].data['color']

favorite_ponies = Product.objects.filter(data__contains={'rating': '5'})
print colored_ponies[0]

all_ponies = Product.objects.all()
for pony in all_ponies:
    print pony
    print pony.data
Something went wrong with that request. Please try again.