Skip to main content

CLI tool for exporting tables or queries from any SQL database to a SQLite file

Project description

db-to-sqlite

PyPI Travis CI License

CLI tool for exporting tables or queries from any SQL database to a SQLite file.

Usage: db-to-sqlite [OPTIONS] PATH

  Load data from any database into SQLite.

  https://github.com/simonw/db-to-sqlite

Options:
  --version          Show the version and exit.
  --connection TEXT  SQLAlchemy connection string  [required]
  --all              Detect and copy all tables
  --table TEXT       Name of table to save the results (and copy)
  --sql TEXT         Optional SQL query to run
  --pk TEXT          Optional column to use as a primary key
  --help             Show this message and exit.

For example, to save the content of the blog_entry table from a PostgreSQL database to a local file called blog.db you could do this:

db-to-sqlite blog.db \
    --connection="postgresql://localhost/myblog" \
    --table=blog_entry

You can also save the data from all of your tables, effectively creating a SQLite copy of your entire database. Any foreign key relationships will be detected and added to the SQLite database. For example:

db-to-sqlite blog.db \
    --connection="postgresql://localhost/myblog" \
    --all

If you want to save the results of a custom SQL query, do this:

db-to-sqlite output.db \
    --connection="postgresql://localhost/myblog" \
    --table=query_results \
    --sql="select id, title, created from blog_entry" \
    --pk=id

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

db_to_sqlite-0.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file db_to_sqlite-0.2-py3-none-any.whl.

File metadata

  • Download URL: db_to_sqlite-0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for db_to_sqlite-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 927b05e85de7ef871e330ee331c32a1349e751e1487181213d007b5d66a6e336
MD5 fd7e55eac4ef00ec8c7573c4be2dd705
BLAKE2b-256 670c0021e253c5335c8f1a54e00fdd886b22f275a75d6da3e21e4a1c663339c1

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