Multicorn-based PostgreSQL foreign data wrapper for Google Spreadsheets
Project description
Google Spreadsheets FDW
Multicorn based PostgreSQL foreign data wrapper for Google Spreadsheets
Installation
Requirements
PostgreSQL 9.1+ with Multicorn extension installed.
If you haven't used Multicorn yet, enable it with:
create extension multicorn;
From source:
git clone https://github.com/TheDeadJoe/google_spreadsheets_fdw
cd google_spreadsheets_fdw
python setup.py install
Usage
create server multicorn_srv foreign data wrapper multicorn options (
wrapper 'google_spreadsheets_fdw.GoogleSpreadsheetFDW'
);
create foreign table my_table (
id int default nextval('my_seq'),
foo varchar,
bar int,
baz float
) server multicorn_srv options (
gskey 'zVshdGDuaQKKaQoXqNOwjeTWcxcUtOlSJDZoLeIMUsYx',
keyfile '/path/to/credentials.json',
sheet '0',
row_id 'id'
);
Options
gskey
- "ID" of a spreadsheet (the 44 char length part between/spreadsheets/d/
and/edit/
from spreadsheet URL)keyfile
- path to Google Cloud Services credentials json filesheet
- index of a sheetrow_id
- name of the column which value will be treated as an ID of the whole row
Example
We start with an empty spreadsheet:
Let's insert some data into it:
insert into my_table(foo, bar, baz) values ('a', 1, 0.1);
insert into my_table(foo, bar, baz) values ('b', 2, 0.2);
insert into my_table(foo, bar, baz) values ('c', 3, 0.3);
insert into my_table(baz, bar, foo) values (0.4, 4, 'd') returning *;
Spreadsheet contains our data.
Now let's try retrieve the data:
select * from my_table;
The result:
Of course, we can also perform other SQL operations e.g.:
update my_table set bar = 9, baz = 0.9 where bar = 2;
delete from my_table where bar > 5;
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for google_spreadsheets_fdw-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa4f1c31d78002dd4dc11689a49a3dd9c999981ec8ab3f893d2327feafce5117 |
|
MD5 | ba740094ca388caf6a48cf751b97611b |
|
BLAKE2b-256 | bced0f1a5d0c82938ebe40d044eefc4d88ca1141f9cc8dcf93a42c4613a3d726 |
Close
Hashes for google_spreadsheets_fdw-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bd08861232186ac18db37e6a56e0fee7085f2832b71d8594e0bd490b8690807 |
|
MD5 | d23359745d12bda7a28ceeee5a115532 |
|
BLAKE2b-256 | 6d4255fcd409903618187774397c17bc4c84db78d73edea9221f197f6b4759ed |