Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add warning about sqlite specific snippet + fix typos #666

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ Create the test database from a custom SQL script

You can replace the :fixture:`django_db_setup` fixture and run any code in its
place. This includes creating your database by hand by running a SQL script
directly. This example shows how sqlite3's executescript method. In more a more
general use cases you probably want to load the SQL statements from a file or
directly. This example shows sqlite3's executescript method. In a more
general use case, you probably want to load the SQL statements from a file or
invoke the ``psql`` or the ``mysql`` command line tool.

Put this in ``conftest.py``::
Expand All @@ -439,6 +439,11 @@ Put this in ``conftest.py``::
INSERT INTO theapp_item (name) VALUES ('created from a sql script');
''')

.. warning::
This snippet shows ``cursor().executescript()`` which is `sqlite` specific, for
other database engines this method might differ. For instance, psycopg2 uses
``cursor().execute()``.


Use a read only database
""""""""""""""""""""""""
Expand Down