Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Interface #98

Open
klucar opened this issue Oct 14, 2016 · 1 comment
Open

SQL Interface #98

klucar opened this issue Oct 14, 2016 · 1 comment

Comments

@klucar
Copy link
Contributor

klucar commented Oct 14, 2016

Postgres has a foreign data wrapper capability that allows you to expose data to postgres. The postgres engine will process sql queries over your data set. I did some experimentation with this in my fdw branch of my fork of timely.

The python I wrote is in these gists:
https://gist.github.com/klucar/2ca41402608a92c5bc2353add3491f9a
https://gist.github.com/klucar/001c6d8df2beb307abcbc3f038292fe1

The python interface enabling this is called Multicorn
http://multicorn.org

@klucar
Copy link
Contributor Author

klucar commented Oct 14, 2016

here's a SQL blob that worked when I had all this hooked up:

CREATE EXTENSION IF NOT EXISTS multicorn;
DROP SERVER IF EXISTS multicorn_timely CASCADE;
CREATE SERVER multicorn_timely FOREIGN DATA WRAPPER multicorn
OPTIONS ( wrapper 'timelyfdw.TimelyForeignDataWrapper' );

CREATE FOREIGN TABLE test (
    a varchar,
    b varchar,
    c varchar,
    d varchar
) SERVER multicorn_timely OPTIONS (
    host 'tb081',
    port '10000',
    table 'test'
);

SELECT * FROM test WHERE a != '0';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants