Remote virtual tables for SQLite, using any Python dbapi driver
Project description
Remotable
Remote virtual tables for SQLite in Python
Remotable is an APSW shell that allows you to pull remote data sources into your SQLite database. Remotable is not a C-extension and thus will only work in the Python APSW shell.
Quick Start
The below example uses pyodbc
to connect to a Microsoft Access database on Windows. You could also use any DBApi compliant driver, as long as you know its connect
parameters.
$ python -m pip install remotable pyodbc
$ python -m remotable [database name]
apsw_prompt> CREATE VIRTUAL TABLE access_table USING remotable(pyodbc, select * from [mytable], 'DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=C:/path/to/a/file.accdb');
CREATE VIRTUAL TABLE Syntax:
CREATE VIRTUAL TABLE <table name> USING remotetable(<python dbapi driver>, <select statement>, <arg1>, <arg2>, ..., <argN>);
Parameters:
python dbapi driver
: A PEP 249-compatible Python DBApi driver, such as pyodbc, teradatasql, ibm_db, sqlite3, etc...
select statement
: A SELECT SQL statement to describe what data to pull from the remote source
arg1
...argN
: A set of arguments, passed to the database driver's connect
statement, that adhere to the following specifications:
- if the argument is a string, which uses single quotes, it is interpreted as a positional parameter (
*args
in Python parlance). Examples of strings:'DSN=DSN1;DATABASE=abc123'
'DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=C:/path/to/a/file.accdb'
- if the argument is an assignment, it is interpreted as a keyword argument (passed to the
connect
's**kwargs
). Examples include:user='username'
password='abc'
- if a keyword argument string contains the phrase
<getpass>
, Remotable will prompt the user for a password for that given argument.
Project details
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
Hashes for remotable-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c11c71c8f5a06654b9ff7d4e61c404ef19f08ef86e5ad741065b01f71dd1b73 |
|
MD5 | cf768415928c20876f14c6633e41c6bf |
|
BLAKE2b-256 | 88f0cfa1f2b4c645f59953bfed0d25bca618fd84b26ec3810d6aeceea68db9de |