All Projects → durch → google-bigtable-postgres-fdw

durch / google-bigtable-postgres-fdw

Licence: MIT license
Google Bigtable Postgres FDW in Rust

Programming Languages

rust
11053 projects
Makefile
30231 projects
python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to google-bigtable-postgres-fdw

emulator-tools
Google Cloud BigTable and PubSub emulator tools to make development a breeze
Stars: ✭ 16 (-56.76%)
Mutual labels:  google-cloud, bigtable
bigtable
TypeScript Bigtable Client with 🔋🔋 included.
Stars: ✭ 13 (-64.86%)
Mutual labels:  google-cloud, bigtable
Odin-Securities
A master database of securities data for use with the Odin algorithmic trading platform.
Stars: ✭ 17 (-54.05%)
Mutual labels:  postgres
migrant lib
Embeddable migration management
Stars: ✭ 22 (-40.54%)
Mutual labels:  postgres
sqlx-adapter
Asynchronous casbin adapter for mysql, postgres, sqlite based on sqlx-rs
Stars: ✭ 27 (-27.03%)
Mutual labels:  postgres
rocket-rest-api-with-jwt
A Rusty Rocket fuelled with Diesel and secured by JWT
Stars: ✭ 62 (+67.57%)
Mutual labels:  postgres
pg-dba-egitim
Eğitim Konuları
Stars: ✭ 23 (-37.84%)
Mutual labels:  postgres
pg-ipc
IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter
Stars: ✭ 27 (-27.03%)
Mutual labels:  postgres
integresql
IntegreSQL manages isolated PostgreSQL databases for your integration tests.
Stars: ✭ 475 (+1183.78%)
Mutual labels:  postgres
django-postgres-copy
Quickly import and export delimited data with Django support for PostgreSQL's COPY command
Stars: ✭ 151 (+308.11%)
Mutual labels:  postgres
ash postgres
A postgresql datalayer for the Ash Framework
Stars: ✭ 21 (-43.24%)
Mutual labels:  postgres
ImageToText
OCR with Google's AI technology (Cloud Vision API)
Stars: ✭ 30 (-18.92%)
Mutual labels:  google-cloud
zorya
Google Cloud Instance Scheduler helping to reduce costs by 60% on average for non-production environments.
Stars: ✭ 127 (+243.24%)
Mutual labels:  google-cloud
pgsink
Logically replicate data out of Postgres into sinks (files, Google BigQuery, etc)
Stars: ✭ 53 (+43.24%)
Mutual labels:  postgres
pycroft
The new AG DSN management system
Stars: ✭ 16 (-56.76%)
Mutual labels:  postgres
rust-goauth
Crate for authenticating Server to Server Apps for Google Cloud Engine.
Stars: ✭ 20 (-45.95%)
Mutual labels:  google-cloud
flan
A tasty tool that lets you save, load and share postgres snapshots with ease
Stars: ✭ 177 (+378.38%)
Mutual labels:  postgres
functions-framework-php
FaaS (Function as a service) framework for writing portable PHP functions
Stars: ✭ 186 (+402.7%)
Mutual labels:  google-cloud
zenith
Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, branching, and bottomless storage.
Stars: ✭ 4,239 (+11356.76%)
Mutual labels:  postgres
ParseCareKit
Securely synchronize any CareKit 2.1+ based app to a Parse Server Cloud. Compatible with parse-hipaa.
Stars: ✭ 28 (-24.32%)
Mutual labels:  postgres

MIT licensed

Google Bigtable Rust PostgreSQL FDW

Rust PostgreSQL foreign data wrapper for interfacing with Google Cloud Bigtable, as well as other API compatible databases (HBase should work with some effort).

While logic is contained in Rust, it leverages PostgreSQL C FDW callbacks.

Quick start

You can get up and running quickly with PG + Rust setup using docker-compose.

docker-compose up -d
docker exec -it `docker ps | grep btpgext_vm | awk '{print $1}'` /bin/bash

This will setup staticly linked Rust 1.16 and PG 9.6 in an Ubuntu Xenial image, and get you in, where you can run make install and start playing.

Roadmap

  • SELECT
  • SELECT LIMIT
  • SELECT OFFSET
  • SELECT WHERE
  • INSERT
  • UPDATE - update can be achived by inserting an existing key
  • DELETE
  • Support for PG 9.3+
  • Useful EXPLAIN
  • Reduce C boilerplate

Installation

  • PostgreSQL 9.6+
  • stable Rust, get it using rustup.
git clone https://github.com/durch/google-bigtable-postgres-fdw.git
cd google-bigtable-postgres-fdw
make install
psql -U postgres

Initial DB setup

CREATE EXTENSION bigtable;
CREATE SERVER test FOREIGN DATA WRAPPER bigtable OPTIONS (instance '`instance_id`', project '`project_id`');
CREATE FOREIGN TABLE test(bt json) SERVER test OPTIONS (name '`table_name`');
CREATE USER MAPPING FOR postgres SERVER TEST OPTIONS (credentials_path '`path_to_service_account_json_credentials`');

Usage

You can use gen.py to generate some test data. Modify gen.py to adjust for the number of generated records, also modify thecolumn key in the generated output as this needs be a column familly that exists in your Bigtable, running python gen.py outputs test.sql, which can be fed into PG.

psql -U postgres < test.sql

SELECT

One Bigtable row per PG rowis returned, limit is done on the BT side, rows are returned as json and can be further manipulated using Postgres json functions and operators. WHERE is evaluted on the PG side so be sure to grab what you need from BT.

SELECT * FROM test;
SELECT * FROM test LIMIT 100;

SELECT bt->'familyName', bt->'qualifier' FROM test WHERE bt->>'rowKey' ~* '.*regex.*';
SELECT bt->'familyName', bt->'qualifier' FROM test WHERE bt->>'rowKey' = 'exact';

INSERT

INSERT takes a json array of rows as defined in core BT lib:

[
    {
        "row_key": "string",
        "family": "string",
        "qualifier": "string",
        "value": "string"
    }
]

As you are passing in one json object which gets inserted using one HTTP request, INSERT counter always shows one row inserted, the real number of rows can be accessed using RETURNING clause.

-- assuming default column name from the conf snippet above:
INSERT INTO test VALUES (
        '[
           {
             "value": "{\"id\": \"6vh22634bst6ysowcquxwd57e15cudr7\", \"lat\": 27, \"lng\": -169)}",
             "qualifier": "test",
             "family": "cf1",
             "row_key": "8xhxbop9azuufgxp"
           }
         ]'
    ) RETURNING bt;

           bt
-------------------------
{"count":1,"meta":"Ok"}
(1 row)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].