]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- The ``sqlalchemy.dialects.postgres`` module, long deprecated, is
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 29 Jan 2016 16:44:58 +0000 (11:44 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 29 Jan 2016 16:44:58 +0000 (11:44 -0500)
removed; this has emitted a warning for many years and projects
should be calling upon ``sqlalchemy.dialects.postgresql``.
Engine URLs of the form ``postgres://`` will still continue to function,
however.

doc/build/changelog/changelog_11.rst
doc/build/changelog/migration_11.rst
lib/sqlalchemy/dialects/__init__.py
lib/sqlalchemy/dialects/postgres.py [deleted file]
test/dialect/postgresql/test_dialect.py

index 511b7b8be642679bf3ac655c3a769687ae11313b..37cb773d8e833af3b890b323db824aedd8b5b823 100644 (file)
 .. changelog::
     :version: 1.1.0b1
 
+    .. change::
+        :tags: change, postgresql
+
+        The ``sqlalchemy.dialects.postgres`` module, long deprecated, is
+        removed; this has emitted a warning for many years and projects
+        should be calling upon ``sqlalchemy.dialects.postgresql``.
+        Engine URLs of the form ``postgres://`` will still continue to function,
+        however.
+
     .. change::
         :tags: bug, sqlite
         :tickets: 3634
index 3be7582269fc2352081a87a461434ad43750679e..5f17b4e7e03791d0ce4089025472e453b1698863 100644 (file)
@@ -16,7 +16,7 @@ What's New in SQLAlchemy 1.1?
     some issues may be moved to later milestones in order to allow
     for a timely release.
 
-    Document last updated: January 19, 2016
+    Document last updated: January 29, 2016
 
 Introduction
 ============
@@ -1364,6 +1364,15 @@ emits::
 
 :ticket:`2729`
 
+The "postgres" module is removed
+---------------------------------
+
+The ``sqlalchemy.dialects.postgres`` module, long deprecated, is
+removed; this has emitted a warning for many years and projects
+should be calling upon ``sqlalchemy.dialects.postgresql``.
+Engine URLs of the form ``postgres://`` will still continue to function,
+however.
+
 Dialect Improvements and Changes - MySQL
 =============================================
 
index af20c39069176b251e917ad56eefa76e78101f6f..bf9c6d38e7cf6cf9af38e93e5b85faad163d93dc 100644 (file)
@@ -17,6 +17,7 @@ __all__ = (
 
 from .. import util
 
+_translates = {'postgres': 'postgresql'}
 
 def _auto_fn(name):
     """default dialect importer.
@@ -30,6 +31,14 @@ def _auto_fn(name):
     else:
         dialect = name
         driver = "base"
+
+    if dialect in _translates:
+        translated = _translates[dialect]
+        util.warn_deprecated(
+            "The '%s' dialect name has been "
+            "renamed to '%s'" % (dialect, translated)
+        )
+        dialect = translated
     try:
         module = __import__('sqlalchemy.dialects.%s' % (dialect, )).dialects
     except ImportError:
diff --git a/lib/sqlalchemy/dialects/postgres.py b/lib/sqlalchemy/dialects/postgres.py
deleted file mode 100644 (file)
index 04d37a2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# dialects/postgres.py
-# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
-# <see AUTHORS file>
-#
-# This module is part of SQLAlchemy and is released under
-# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
-# backwards compat with the old name
-from sqlalchemy.util import warn_deprecated
-
-warn_deprecated(
-    "The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to "
-    "'postgresql'. The new URL format is "
-    "postgresql[+driver]://<user>:<pass>@<host>/<dbname>"
-)
-
-from sqlalchemy.dialects.postgresql import *
-from sqlalchemy.dialects.postgresql import base
index 52620bb78bb03f7af9f0a5f5b554e0b524a90214..c0e1819d628c4be7f04b8cf995ada3d37853c10a 100644 (file)
@@ -15,6 +15,9 @@ import logging
 import logging.handlers
 from sqlalchemy.testing.mock import Mock
 from sqlalchemy.engine import engine_from_config
+from sqlalchemy.engine import url
+from sqlalchemy.testing import is_
+from sqlalchemy.testing import expect_deprecated
 
 
 class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
@@ -79,6 +82,13 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
             psycopg2.Error)
         assert isinstance(exception, exc.OperationalError)
 
+    def test_deprecated_dialect_name_still_loads(self):
+        with expect_deprecated(
+                "The 'postgres' dialect name "
+                "has been renamed to 'postgresql'"):
+            dialect = url.URL("postgres").get_dialect()
+        is_(dialect, postgresql.dialect)
+
     # currently not passing with pg 9.3 that does not seem to generate
     # any notices here, would rather find a way to mock this
     @testing.requires.no_coverage