home / content / repos

repos: 166159072

This data as json

id node_id name full_name private owner html_url description fork created_at updated_at pushed_at homepage size stargazers_count watchers_count language has_issues has_projects has_downloads has_wiki has_pages forks_count archived disabled open_issues_count license topics forks open_issues watchers default_branch permissions temp_clone_token organization network_count subscribers_count readme readme_html allow_forking visibility is_template template_repository web_commit_signoff_required has_discussions
166159072 MDEwOlJlcG9zaXRvcnkxNjYxNTkwNzI= db-to-sqlite simonw/db-to-sqlite 0 9599 https://github.com/simonw/db-to-sqlite CLI tool for exporting tables or queries from any SQL database to a SQLite file 0 2019-01-17T04:16:48Z 2021-06-11T22:52:12Z 2021-06-11T22:55:56Z   77 226 226 Python 1 1 1 1 0 12 0 0 2 apache-2.0 ["sqlalchemy", "sqlite", "datasette", "datasette-io", "datasette-tool"] 12 2 226 main {"admin": false, "push": false, "pull": false}     12 4 # db-to-sqlite [![PyPI](https://img.shields.io/pypi/v/db-to-sqlite.svg)](https://pypi.python.org/pypi/db-to-sqlite) [![Changelog](https://img.shields.io/github/v/release/simonw/db-to-sqlite?include_prereleases&label=changelog)](https://github.com/simonw/db-to-sqlite/releases) [![Tests](https://github.com/simonw/db-to-sqlite/workflows/Test/badge.svg)](https://github.com/simonw/db-to-sqlite/actions?query=workflow%3ATest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/db-to-sqlite/blob/main/LICENSE) CLI tool for exporting tables or queries from any SQL database to a SQLite file. ## Installation Install from PyPI like so: pip install db-to-sqlite If you want to use it with MySQL, you can install the extra dependency like this: pip install 'db-to-sqlite[mysql]' Installing the `mysqlclient` library on OS X can be tricky - I've found [this recipe](https://gist.github.com/simonw/90ac0afd204cd0d6d9c3135c3888d116) to work (run that before installing `db-to-sqlite`). For PostgreSQL, use this: pip install 'db-to-sqlite[postgresql]' ## Usage Usage: db-to-sqlite [OPTIONS] CONNECTION PATH Load data from any database into SQLite. PATH is a path to the SQLite file to create, e.c. /tmp/my_database.db CONNECTION is a SQLAlchemy connection string, for example: postgresql://localhost/my_database postgresql://username:passwd@localhost/my_database mysql://root@localhost/my_database mysql://username:passwd@localhost/my_database More: https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls Options: --version Show the version and exit. --all Detect and copy all tables --table TEXT Specific tables to copy --skip TEXT When using --all skip these tables --redact TEXT... (table, column) pairs to redact with *** --sql TEXT Optional SQL query to run --output TEXT Table in which to save --sql query results --pk TEXT Optional column to use as a primary key --index-fks / --no-index-fks Should foreign keys have indexes? Default on -p, --progress Show progress bar --postgres-schema TEXT PostgreSQL schema to use --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 "postgresql://localhost/myblog" blog.db \ --table=blog_entry You can specify `--table` more than once. 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 "postgresql://localhost/myblog" blog.db \ --all When running `--all` you can specify tables to skip using `--skip`: db-to-sqlite "postgresql://localhost/myblog" blog.db \ --all \ --skip=django_migrations If you want to save the results of a custom SQL query, do this: db-to-sqlite "postgresql://localhost/myblog" output.db \ --output=query_results \ --sql="select id, title, created from blog_entry" \ --pk=id The `--output` option specifies the table that should contain the results of the query. ## Using db-to-sqlite with PostgreSQL schemas If the tables you want to copy from your PostgreSQL database aren't in the default schema, you can specify an alternate one with the `--postgres-schema` option: db-to-sqlite "postgresql://localhost/myblog" blog.db \ --all \ --postgres-schema my_schema ## Using db-to-sqlite with Heroku Postgres If you run an application on [Heroku](https://www.heroku.com/) using their [Postgres database product](https://www.heroku.com/postgres), you can use the `heroku config` command to access a compatible connection string: $ heroku config --app myappname | grep HEROKU_POSTG HEROKU_POSTGRESQL_OLIVE_URL: postgres://username:password@ec2-xxx-xxx-xxx-x.compute-1.amazonaws.com:5432/dbname You can pass this to `db-to-sqlite` to create a local SQLite database with the data from your Heroku instance. You can even do this using a bash one-liner: $ db-to-sqlite $(heroku config --app myappname | grep HEROKU_POSTG | cut -d: -f 2-) \ /tmp/heroku.db --all -p 1/23: django_migrations ... 17/23: blog_blogmark [####################################] 100% ... ## Related projects * [Datasette](https://github.com/simonw/datasette): A tool for exploring and publishing data. Works great with SQLite files generated using `db-to-sqlite`. * [sqlite-utils](https://github.com/simonw/sqlite-utils): Python CLI utility and library for manipulating SQLite databases. * [csvs-to-sqlite](https://github.com/simonw/csvs-to-sqlite): Convert CSV files into a SQLite database. ## Development To set up this tool locally, first checkout the code. Then create a new virtual environment: cd db-to-sqlite python3 -mvenv venv source venv/bin/activate Or if you are using `pipenv`: pipenv shell Now install the dependencies and test dependencies: pip install -e '.[test]' To run the tests: pytest This will skip tests against MySQL or PostgreSQL if you do not have their additional dependencies installed. You can install those extra dependencies like so: pip install -e '.[test_mysql,test_postgresql]' You can alternative use `pip install psycopg2-binary` if you cannot install the `psycopg2` dependency used by the `test_postgresql` extra. See [Running a MySQL server using Homebrew](https://til.simonwillison.net/homebrew/mysql-homebrew) for tips on running the tests against MySQL on macOS, including how to install the `mysqlclient` dependency. The PostgreSQL and MySQL tests default to expecting to run against servers on localhost. You can use environment variables to point them at different test database servers: - `MYSQL_TEST_DB_CONNECTION` - defaults to `mysql://root@localhost/test_db_to_sqlite` - `POSTGRESQL_TEST_DB_CONNECTION` - defaults to `postgresql://localhost/test_db_to_sqlite` The database you indicate in the environment variable - `test_db_to_sqlite` by default - will be deleted and recreated on every test run. <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1><a id="user-content-db-to-sqlite" class="anchor" aria-hidden="true" href="#user-content-db-to-sqlite"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>db-to-sqlite</h1> <p><a href="https://pypi.python.org/pypi/db-to-sqlite" rel="nofollow"><img src="https://camo.githubusercontent.com/b34869a6692a0e2ab6754463aad8578fe9f594788d99d4fd7ae2d815735d1660/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f64622d746f2d73716c6974652e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/db-to-sqlite.svg" style="max-width:100%;"></a> <a href="https://github.com/simonw/db-to-sqlite/releases"><img src="https://camo.githubusercontent.com/0f168b599361c3b2242a18a2b84f49d1c4e5520c7c425a89f43fd1b6f337f299/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73696d6f6e772f64622d746f2d73716c6974653f696e636c7564655f70726572656c6561736573266c6162656c3d6368616e67656c6f67" alt="Changelog" data-canonical-src="https://img.shields.io/github/v/release/simonw/db-to-sqlite?include_prereleases&amp;label=changelog" style="max-width:100%;"></a> <a href="https://github.com/simonw/db-to-sqlite/actions?query=workflow%3ATest"><img src="https://github.com/simonw/db-to-sqlite/workflows/Test/badge.svg" alt="Tests" style="max-width:100%;"></a> <a href="https://github.com/simonw/db-to-sqlite/blob/main/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width:100%;"></a></p> <p>CLI tool for exporting tables or queries from any SQL database to a SQLite file.</p> <h2><a id="user-content-installation" class="anchor" aria-hidden="true" href="#user-content-installation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Installation</h2> <p>Install from PyPI like so:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install db-to-sqlite "><pre><code>pip install db-to-sqlite </code></pre></div> <p>If you want to use it with MySQL, you can install the extra dependency like this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install 'db-to-sqlite[mysql]' "><pre><code>pip install 'db-to-sqlite[mysql]' </code></pre></div> <p>Installing the <code>mysqlclient</code> library on OS X can be tricky - I've found <a href="https://gist.github.com/simonw/90ac0afd204cd0d6d9c3135c3888d116">this recipe</a> to work (run that before installing <code>db-to-sqlite</code>).</p> <p>For PostgreSQL, use this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install 'db-to-sqlite[postgresql]' "><pre><code>pip install 'db-to-sqlite[postgresql]' </code></pre></div> <h2><a id="user-content-usage" class="anchor" aria-hidden="true" href="#user-content-usage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Usage</h2> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="Usage: db-to-sqlite [OPTIONS] CONNECTION PATH Load data from any database into SQLite. PATH is a path to the SQLite file to create, e.c. /tmp/my_database.db CONNECTION is a SQLAlchemy connection string, for example: postgresql://localhost/my_database postgresql://username:passwd@localhost/my_database mysql://root@localhost/my_database mysql://username:passwd@localhost/my_database More: https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls Options: --version Show the version and exit. --all Detect and copy all tables --table TEXT Specific tables to copy --skip TEXT When using --all skip these tables --redact TEXT... (table, column) pairs to redact with *** --sql TEXT Optional SQL query to run --output TEXT Table in which to save --sql query results --pk TEXT Optional column to use as a primary key --index-fks / --no-index-fks Should foreign keys have indexes? Default on -p, --progress Show progress bar --postgres-schema TEXT PostgreSQL schema to use --help Show this message and exit. "><pre><code>Usage: db-to-sqlite [OPTIONS] CONNECTION PATH Load data from any database into SQLite. PATH is a path to the SQLite file to create, e.c. /tmp/my_database.db CONNECTION is a SQLAlchemy connection string, for example: postgresql://localhost/my_database postgresql://username:passwd@localhost/my_database mysql://root@localhost/my_database mysql://username:passwd@localhost/my_database More: https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls Options: --version Show the version and exit. --all Detect and copy all tables --table TEXT Specific tables to copy --skip TEXT When using --all skip these tables --redact TEXT... (table, column) pairs to redact with *** --sql TEXT Optional SQL query to run --output TEXT Table in which to save --sql query results --pk TEXT Optional column to use as a primary key --index-fks / --no-index-fks Should foreign keys have indexes? Default on -p, --progress Show progress bar --postgres-schema TEXT PostgreSQL schema to use --help Show this message and exit. </code></pre></div> <p>For example, to save the content of the <code>blog_entry</code> table from a PostgreSQL database to a local file called <code>blog.db</code> you could do this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="db-to-sqlite &quot;postgresql://localhost/myblog&quot; blog.db \ --table=blog_entry "><pre><code>db-to-sqlite "postgresql://localhost/myblog" blog.db \ --table=blog_entry </code></pre></div> <p>You can specify <code>--table</code> more than once.</p> <p>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:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="db-to-sqlite &quot;postgresql://localhost/myblog&quot; blog.db \ --all "><pre><code>db-to-sqlite "postgresql://localhost/myblog" blog.db \ --all </code></pre></div> <p>When running <code>--all</code> you can specify tables to skip using <code>--skip</code>:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="db-to-sqlite &quot;postgresql://localhost/myblog&quot; blog.db \ --all \ --skip=django_migrations "><pre><code>db-to-sqlite "postgresql://localhost/myblog" blog.db \ --all \ --skip=django_migrations </code></pre></div> <p>If you want to save the results of a custom SQL query, do this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="db-to-sqlite &quot;postgresql://localhost/myblog&quot; output.db \ --output=query_results \ --sql=&quot;select id, title, created from blog_entry&quot; \ --pk=id "><pre><code>db-to-sqlite "postgresql://localhost/myblog" output.db \ --output=query_results \ --sql="select id, title, created from blog_entry" \ --pk=id </code></pre></div> <p>The <code>--output</code> option specifies the table that should contain the results of the query.</p> <h2><a id="user-content-using-db-to-sqlite-with-postgresql-schemas" class="anchor" aria-hidden="true" href="#user-content-using-db-to-sqlite-with-postgresql-schemas"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Using db-to-sqlite with PostgreSQL schemas</h2> <p>If the tables you want to copy from your PostgreSQL database aren't in the default schema, you can specify an alternate one with the <code>--postgres-schema</code> option:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="db-to-sqlite &quot;postgresql://localhost/myblog&quot; blog.db \ --all \ --postgres-schema my_schema "><pre><code>db-to-sqlite "postgresql://localhost/myblog" blog.db \ --all \ --postgres-schema my_schema </code></pre></div> <h2><a id="user-content-using-db-to-sqlite-with-heroku-postgres" class="anchor" aria-hidden="true" href="#user-content-using-db-to-sqlite-with-heroku-postgres"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Using db-to-sqlite with Heroku Postgres</h2> <p>If you run an application on <a href="https://www.heroku.com/" rel="nofollow">Heroku</a> using their <a href="https://www.heroku.com/postgres" rel="nofollow">Postgres database product</a>, you can use the <code>heroku config</code> command to access a compatible connection string:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="$ heroku config --app myappname | grep HEROKU_POSTG HEROKU_POSTGRESQL_OLIVE_URL: postgres://username:password@ec2-xxx-xxx-xxx-x.compute-1.amazonaws.com:5432/dbname "><pre><code>$ heroku config --app myappname | grep HEROKU_POSTG HEROKU_POSTGRESQL_OLIVE_URL: postgres://username:password@ec2-xxx-xxx-xxx-x.compute-1.amazonaws.com:5432/dbname </code></pre></div> <p>You can pass this to <code>db-to-sqlite</code> to create a local SQLite database with the data from your Heroku instance.</p> <p>You can even do this using a bash one-liner:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="$ db-to-sqlite $(heroku config --app myappname | grep HEROKU_POSTG | cut -d: -f 2-) \ /tmp/heroku.db --all -p 1/23: django_migrations ... 17/23: blog_blogmark [####################################] 100% ... "><pre><code>$ db-to-sqlite $(heroku config --app myappname | grep HEROKU_POSTG | cut -d: -f 2-) \ /tmp/heroku.db --all -p 1/23: django_migrations ... 17/23: blog_blogmark [####################################] 100% ... </code></pre></div> <h2><a id="user-content-related-projects" class="anchor" aria-hidden="true" href="#user-content-related-projects"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Related projects</h2> <ul> <li><a href="https://github.com/simonw/datasette">Datasette</a>: A tool for exploring and publishing data. Works great with SQLite files generated using <code>db-to-sqlite</code>.</li> <li><a href="https://github.com/simonw/sqlite-utils">sqlite-utils</a>: Python CLI utility and library for manipulating SQLite databases.</li> <li><a href="https://github.com/simonw/csvs-to-sqlite">csvs-to-sqlite</a>: Convert CSV files into a SQLite database.</li> </ul> <h2><a id="user-content-development" class="anchor" aria-hidden="true" href="#user-content-development"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Development</h2> <p>To set up this tool locally, first checkout the code. Then create a new virtual environment:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="cd db-to-sqlite python3 -mvenv venv source venv/bin/activate "><pre><code>cd db-to-sqlite python3 -mvenv venv source venv/bin/activate </code></pre></div> <p>Or if you are using <code>pipenv</code>:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pipenv shell "><pre><code>pipenv shell </code></pre></div> <p>Now install the dependencies and test dependencies:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install -e '.[test]' "><pre><code>pip install -e '.[test]' </code></pre></div> <p>To run the tests:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pytest "><pre><code>pytest </code></pre></div> <p>This will skip tests against MySQL or PostgreSQL if you do not have their additional dependencies installed.</p> <p>You can install those extra dependencies like so:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install -e '.[test_mysql,test_postgresql]' "><pre><code>pip install -e '.[test_mysql,test_postgresql]' </code></pre></div> <p>You can alternative use <code>pip install psycopg2-binary</code> if you cannot install the <code>psycopg2</code> dependency used by the <code>test_postgresql</code> extra.</p> <p>See <a href="https://til.simonwillison.net/homebrew/mysql-homebrew" rel="nofollow">Running a MySQL server using Homebrew</a> for tips on running the tests against MySQL on macOS, including how to install the <code>mysqlclient</code> dependency.</p> <p>The PostgreSQL and MySQL tests default to expecting to run against servers on localhost. You can use environment variables to point them at different test database servers:</p> <ul> <li><code>MYSQL_TEST_DB_CONNECTION</code> - defaults to <code>mysql://root@localhost/test_db_to_sqlite</code></li> <li><code>POSTGRESQL_TEST_DB_CONNECTION</code> - defaults to <code>postgresql://localhost/test_db_to_sqlite</code></li> </ul> <p>The database you indicate in the environment variable - <code>test_db_to_sqlite</code> by default - will be deleted and recreated on every test run.</p> </article></div>            

Links from other tables

  • 16 rows from repo in releases
Powered by Datasette · Queries took 2.874ms