Skip to main content

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 extension 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]

sqlite> CREATE VIRTUAL TABLE access_table USING remotable(pyodbc, mytable, 'DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=C:/path/to/a/file.accdb', querytype=table);

CREATE VIRTUAL TABLE Syntax:

CREATE VIRTUAL TABLE <table name> USING remotetable(<python dbapi driver>, <select statement>, <arg1>, <arg2>, ..., <argN>, <querytype>);

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.

Special arguments:

There are some special keywords that you can optionally provide after the connect arguments.

  • querytype: Either table, or query. If not provided, the default is table. This means that the query you provided corresponds to a table name, and is not actual SQL.

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

remotable-1.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

remotable-1.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file remotable-1.2.0.tar.gz.

File metadata

  • Download URL: remotable-1.2.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for remotable-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a7a176a2b9fcbb9b79eff466e54ba440128d7f5fb752c2d607ff65189d67a832
MD5 45c539ded5c91e8dcecafb4ace802280
BLAKE2b-256 0210bf743d379f3a3924295e5baa29cf7339a072e1920975e765af415515b676

See more details on using hashes here.

File details

Details for the file remotable-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: remotable-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for remotable-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdd589a2501c3a4ee00c8ea1fe9ae756d61a1faf62027606fd83584d55855fcc
MD5 6d0a5db5db48770e7d6c0957a2228a14
BLAKE2b-256 d094beefc5889435e7a6cb3cdb2d98f1b39250485534bca5995982f805ad622e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page