Loading django/core/management/sql.py +22 −13 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from django.conf import settings from django.core.management.base import CommandError from django.db import models, router from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning def sql_create(app_config, style, connection): Loading Loading @@ -155,6 +155,13 @@ def sql_all(app_config, style, connection): def _split_statements(content): try: import sqlparse except ImportError: warnings.warn( "Providing intial SQL data works better with sqlparse installed " "and it will be required in Django 2.0.", RemovedInDjango20Warning ) comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$") statements = [] statement = [] Loading @@ -167,6 +174,8 @@ def _split_statements(content): statements.append(" ".join(statement)) statement = [] return statements else: return sqlparse.split(content.strip()) def custom_sql_for_model(model, style, connection): Loading docs/howto/initial-data.txt +8 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,14 @@ directories. Providing initial SQL data ========================== .. deprecated:: 1.8 Historically this functionality has used regular expression parsing of the initial SQL which is a bit buggy. This parsing is now deprecated in favor of installing `sqlparse <https://pypi.python.org/pypi/sqlparse>`_; doing so will be required for this functionality in Django 2.0. You can install it using ``pip install sqlparse``. Django provides a hook for passing the database arbitrary SQL that's executed just after the CREATE TABLE statements when you run :djadmin:`migrate`. You can use this hook to populate default records, or you could also create SQL Loading docs/internals/contributing/writing-code/unit-tests.txt +2 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ dependencies: * memcached_, plus a :ref:`supported Python binding <memcached>` * gettext_ (:ref:`gettext_on_windows`) * selenium_ * sqlparse_ You can find these dependencies in `pip requirements files`_ inside the ``tests/requirements`` directory of the Django source tree and install them Loading Loading @@ -197,6 +198,7 @@ associated tests will be skipped. .. _memcached: http://memcached.org/ .. _gettext: http://www.gnu.org/software/gettext/manual/gettext.html .. _selenium: https://pypi.python.org/pypi/selenium .. _sqlparse: https://pypi.python.org/pypi/sqlparse .. _pip requirements files: http://www.pip-installer.org/en/latest/cookbook.html#requirements-files Code coverage Loading docs/internals/deprecation.txt +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ about each item can often be found in the release notes of two versions prior. * Using an incorrect count of unpacked values in the ``for`` template tag will raise an exception rather than fail silently. * The regular expression parsing of SQL initial data will be removed and ``sqlparse`` will be required for the feature. .. _deprecation-removed-in-1.9: 1.9 Loading docs/releases/1.8.txt +12 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,9 @@ Management Commands * :djadmin:`dumpdata` now has the option :djadminopt:`--output` which allows specifying the file to which the serialized data is written. * :ref:`initial-sql` now works better if the `sqlparse <https://pypi.python.org/pypi/sqlparse>`_ Python library is installed. Models ^^^^^^ Loading Loading @@ -276,3 +279,12 @@ Using an incorrect count of unpacked values in the :ttag:`for` template tag Using an incorrect count of unpacked values in :ttag:`for` tag will raise an exception rather than fail silently in Django 2.0. Regular expression parsing of initial SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The somewhat buggy regular expression logic used for parsing :ref:`SQL initial data <initial-sql>` has been deprecated. Install `sqlparse <https://pypi.python.org/pypi/sqlparse>`_ if you wish to use this feature. Doing so will be required in Django 2.0 when the regular expression logic is removed. Loading
django/core/management/sql.py +22 −13 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from django.conf import settings from django.core.management.base import CommandError from django.db import models, router from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning def sql_create(app_config, style, connection): Loading Loading @@ -155,6 +155,13 @@ def sql_all(app_config, style, connection): def _split_statements(content): try: import sqlparse except ImportError: warnings.warn( "Providing intial SQL data works better with sqlparse installed " "and it will be required in Django 2.0.", RemovedInDjango20Warning ) comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$") statements = [] statement = [] Loading @@ -167,6 +174,8 @@ def _split_statements(content): statements.append(" ".join(statement)) statement = [] return statements else: return sqlparse.split(content.strip()) def custom_sql_for_model(model, style, connection): Loading
docs/howto/initial-data.txt +8 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,14 @@ directories. Providing initial SQL data ========================== .. deprecated:: 1.8 Historically this functionality has used regular expression parsing of the initial SQL which is a bit buggy. This parsing is now deprecated in favor of installing `sqlparse <https://pypi.python.org/pypi/sqlparse>`_; doing so will be required for this functionality in Django 2.0. You can install it using ``pip install sqlparse``. Django provides a hook for passing the database arbitrary SQL that's executed just after the CREATE TABLE statements when you run :djadmin:`migrate`. You can use this hook to populate default records, or you could also create SQL Loading
docs/internals/contributing/writing-code/unit-tests.txt +2 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ dependencies: * memcached_, plus a :ref:`supported Python binding <memcached>` * gettext_ (:ref:`gettext_on_windows`) * selenium_ * sqlparse_ You can find these dependencies in `pip requirements files`_ inside the ``tests/requirements`` directory of the Django source tree and install them Loading Loading @@ -197,6 +198,7 @@ associated tests will be skipped. .. _memcached: http://memcached.org/ .. _gettext: http://www.gnu.org/software/gettext/manual/gettext.html .. _selenium: https://pypi.python.org/pypi/selenium .. _sqlparse: https://pypi.python.org/pypi/sqlparse .. _pip requirements files: http://www.pip-installer.org/en/latest/cookbook.html#requirements-files Code coverage Loading
docs/internals/deprecation.txt +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ about each item can often be found in the release notes of two versions prior. * Using an incorrect count of unpacked values in the ``for`` template tag will raise an exception rather than fail silently. * The regular expression parsing of SQL initial data will be removed and ``sqlparse`` will be required for the feature. .. _deprecation-removed-in-1.9: 1.9 Loading
docs/releases/1.8.txt +12 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,9 @@ Management Commands * :djadmin:`dumpdata` now has the option :djadminopt:`--output` which allows specifying the file to which the serialized data is written. * :ref:`initial-sql` now works better if the `sqlparse <https://pypi.python.org/pypi/sqlparse>`_ Python library is installed. Models ^^^^^^ Loading Loading @@ -276,3 +279,12 @@ Using an incorrect count of unpacked values in the :ttag:`for` template tag Using an incorrect count of unpacked values in :ttag:`for` tag will raise an exception rather than fail silently in Django 2.0. Regular expression parsing of initial SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The somewhat buggy regular expression logic used for parsing :ref:`SQL initial data <initial-sql>` has been deprecated. Install `sqlparse <https://pypi.python.org/pypi/sqlparse>`_ if you wish to use this feature. Doing so will be required in Django 2.0 when the regular expression logic is removed.