Skip to content

amitlan/sqlite_fdw

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlite_fdw

Foreign Data Wrapper for sqlite

Compilation

To use this FDW, you first need to compile it. You'll need pg_config and the usual build toolset. Then just launch:

make
make install

And you're good to go.

Adding the extension

Connect to your database, and execute this query:

CREATE EXTENSION sqlite_fdw;

Using it

You first need to add a server. It will have an option, the sqlite file path. It must be readable by the postgres process.

CREATE SERVER sqlite_server
  FOREIGN DATA WRAPPER sqlite_fdw
  OPTIONS (database '/var/lib/pgsql/test.db');

Then you can create your foreign table. It will have one option, the table name on the sqlite database:

CREATE FOREIGN TABLE local_t1(... columns ...)
  SERVER sqlite_server
  OPTIONS (table 'remote_table');

Now, to get the contents of the remote table, you just need to execute a SELECT query on it:

SELECT * FROM local_t1;

About

Foreign Data Wrapper for sqlite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.8%
  • Makefile 2.2%