Skip to content

Commit

Permalink
docs: add warning about sqlite specific snippet + fix typos [ci skip] (
Browse files Browse the repository at this point in the history
  • Loading branch information
streeck authored and blueyed committed Oct 26, 2018
1 parent 8f741ff commit 22ebd0a
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 22ebd0a

Please sign in to comment.