BedquiltDB is a A JSON document-store built on PostgreSQL.
Release packages for BedquiltDB can be found on pgxn.
Project documnetation hosted at Read The Docs.
To build documentation, install the mkdocs
utility and run:
$ make docs
This extension provides the core functionality of BedquiltDB, and can be used from ordinary SQL queries, though it is recommended to use one of the driver libraries for you favourite programming language instead.
-- Insert two documents into the 'people' collection.
select bq_insert(
'people',
'{"_id": "sarah@example.com",
"name": "Sarah",
"likes": ["icecream", "code"]}'
);
select bq_insert(
'people',
'{"name": "Mike",
"likes": ["code", "rabbits"]}'
);
-- Find a single document,
-- where the "name" field is the string value "Mike".
select bq_find_one(
'people',
'{"name": "Mike"}'
);
-- Find all documents in the 'people' collection
select bq_find('people', '{}');
-- Find all people who like icecream
select bq_find('people', '{"likes": ["icecream"]}');
-- Find a single document by its "_id" field.
-- This query hits the primary key index on the _id field
select bq_find_one_by_id('people', 'sarah@example.com');
-- Create an empty collection
select bq_create_collection('things');
-- Get a list of existing collections
select bq_list_collections();
BedquiltDB is intended to be used with client libraries (aka Drivers), such as:
Installation instructions and documentation for each driver can be found on the respective driver repositories.
BedquiltDB can also be used directly through SQL queries: select bq_find('users', '{...}')
.
pip install pyscopg2
)To install BedquiltDB on your PostgreSQL server, follow the instructions here:
http://bedquiltdb.readthedocs.org/en/latest/guide/installation/
If you would prefer to install from source, first clone this repositroy:
$ git clone https://github.com/BedquiltDB/bedquilt-core.git
$ cd bedquilt-core
Run the following to build the extension and install it to the local database:
$ sudo make install
Run this to build to a zip file:
$ make dist
Then, on the postgres server:
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS plpython3u;
CREATE EXTENSION bedquilt;
Test out the bedquilt extension by running a simple find
operation:
select bq_find('stuff', '{}');
Run make test
to run the test suite. Requires a bedquilt_test
database
that the current user owns.
Contributions are welcome, to any of the BedquiltDB projects. Just open an issue, or get in touch directly.
Bedquilt is released under the MIT License.