Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Python client for Postgrest.


pip install --process-dependency-links

Example Usage

    import postgrest

    class MyTable(postgrest.Resource):
        _meta_table_name = 'my_table'

        def _get_or_create_keys(self):
            return ('col1',)

        def _pk_dict(self):
            return {'id': 'eq.%s' %}

    class MyPostgrestAPI(postgrest.PostgrestAPI):
        resources = [MyTable]

    api = MyPostgrestAPI('')

    obj = api.MyTable.get({'id': 'eq.1'})

    objs = api.MyTable.filter({'id': 'lte.10', 'col1': ''})

    # filter accepts any syntax that is in postgrest http GET spec
    objs = api.MyTable.filter({
        'id': 'lte.10',
        'col1->obj->>property': 'like.*example*',
        'select': 'id,col1,col2',
        'order': 'id.asc'

    # get_or_create, inspired by django's orm
    obj, created = api.MyTable.get_or_create({
        'col1': 'foo'
You can’t perform that action at this time.