summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/firebird/base.py15
-rw-r--r--lib/sqlalchemy/dialects/mssql/__init__.py1
-rw-r--r--lib/sqlalchemy/dialects/mssql/adodbapi.py90
-rw-r--r--lib/sqlalchemy/dialects/mssql/mxodbc.py4
-rw-r--r--lib/sqlalchemy/dialects/mysql/oursql.py10
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pygresql.py11
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pypostgresql.py16
-rw-r--r--lib/sqlalchemy/dialects/sqlite/pysqlcipher.py1
-rw-r--r--lib/sqlalchemy/dialects/sybase/base.py11
-rw-r--r--lib/sqlalchemy/dialects/sybase/mxodbc.py1
-rw-r--r--lib/sqlalchemy/dialects/sybase/pyodbc.py5
11 files changed, 71 insertions, 94 deletions
diff --git a/lib/sqlalchemy/dialects/firebird/base.py b/lib/sqlalchemy/dialects/firebird/base.py
index 5779ac885..b7260403a 100644
--- a/lib/sqlalchemy/dialects/firebird/base.py
+++ b/lib/sqlalchemy/dialects/firebird/base.py
@@ -16,6 +16,10 @@ r"""
dialect is not tested within continuous integration and is likely to have
many issues and caveats not currently handled.
+.. deprecated:: 1.4 This dialect is deprecated and will be removed
+ in a future version. This dialect is superseded by the external
+ version available at external-dialect_.
+
Firebird Dialects
-----------------
@@ -73,7 +77,7 @@ the SQLAlchemy ``returning()`` method, such as::
.. _dialects: http://mc-computing.com/Databases/Firebird/SQL_Dialect.html
-
+.. _external-dialect: https://github.com/pauldex/sqlalchemy-firebird
"""
import datetime
@@ -648,6 +652,15 @@ class FBDialect(default.DefaultDialect):
# first connect
_version_two = True
+ def __init__(self, *args, **kwargs):
+ util.warn_deprecated(
+ "The firebird dialect is deprecated and will be removed "
+ "in a future version. This dialect is superseded by the external "
+ "dialect https://github.com/pauldex/sqlalchemy-firebird.",
+ version="1.4",
+ )
+ super(FBDialect, self).__init__(*args, **kwargs)
+
def initialize(self, connection):
super(FBDialect, self).initialize(connection)
self._version_two = (
diff --git a/lib/sqlalchemy/dialects/mssql/__init__.py b/lib/sqlalchemy/dialects/mssql/__init__.py
index 67830affe..283c92eca 100644
--- a/lib/sqlalchemy/dialects/mssql/__init__.py
+++ b/lib/sqlalchemy/dialects/mssql/__init__.py
@@ -5,7 +5,6 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from . import adodbapi # noqa
from . import base # noqa
from . import mxodbc # noqa
from . import pymssql # noqa
diff --git a/lib/sqlalchemy/dialects/mssql/adodbapi.py b/lib/sqlalchemy/dialects/mssql/adodbapi.py
deleted file mode 100644
index 15f1b6511..000000000
--- a/lib/sqlalchemy/dialects/mssql/adodbapi.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# mssql/adodbapi.py
-# Copyright (C) 2005-2020 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
-
-"""
-.. dialect:: mssql+adodbapi
- :name: adodbapi
- :dbapi: adodbapi
- :connectstring: mssql+adodbapi://<username>:<password>@<dsnname>
- :url: http://adodbapi.sourceforge.net/
-
-.. note::
-
- The adodbapi dialect is not implemented in SQLAlchemy versions 0.6 and
- above at this time.
-
-"""
-import datetime
-import sys
-
-from sqlalchemy import types as sqltypes
-from sqlalchemy import util
-from sqlalchemy.dialects.mssql.base import MSDateTime
-from sqlalchemy.dialects.mssql.base import MSDialect
-
-
-class MSDateTime_adodbapi(MSDateTime):
- def result_processor(self, dialect, coltype):
- def process(value):
- # adodbapi will return datetimes with empty time
- # values as datetime.date() objects.
- # Promote them back to full datetime.datetime()
- if type(value) is datetime.date:
- return datetime.datetime(value.year, value.month, value.day)
- return value
-
- return process
-
-
-class MSDialect_adodbapi(MSDialect):
- supports_sane_rowcount = True
- supports_sane_multi_rowcount = True
- supports_unicode = sys.maxunicode == 65535
- supports_unicode_statements = True
- driver = "adodbapi"
-
- @classmethod
- def import_dbapi(cls):
- import adodbapi as module
-
- return module
-
- colspecs = util.update_copy(
- MSDialect.colspecs, {sqltypes.DateTime: MSDateTime_adodbapi}
- )
-
- def create_connect_args(self, url):
- def check_quote(token):
- if ";" in str(token):
- token = "'%s'" % token
- return token
-
- keys = dict((k, check_quote(v)) for k, v in url.query.items())
-
- connectors = ["Provider=SQLOLEDB"]
- if "port" in keys:
- connectors.append(
- "Data Source=%s, %s" % (keys.get("host"), keys.get("port"))
- )
- else:
- connectors.append("Data Source=%s" % keys.get("host"))
- connectors.append("Initial Catalog=%s" % keys.get("database"))
- user = keys.get("user")
- if user:
- connectors.append("User Id=%s" % user)
- connectors.append("Password=%s" % keys.get("password", ""))
- else:
- connectors.append("Integrated Security=SSPI")
- return [[";".join(connectors)], {}]
-
- def is_disconnect(self, e, connection, cursor):
- return isinstance(
- e, self.dbapi.adodbapi.DatabaseError
- ) and "'connection failure'" in str(e)
-
-
-dialect = MSDialect_adodbapi
diff --git a/lib/sqlalchemy/dialects/mssql/mxodbc.py b/lib/sqlalchemy/dialects/mssql/mxodbc.py
index 5df1351d2..998153d7a 100644
--- a/lib/sqlalchemy/dialects/mssql/mxodbc.py
+++ b/lib/sqlalchemy/dialects/mssql/mxodbc.py
@@ -12,6 +12,10 @@
:connectstring: mssql+mxodbc://<username>:<password>@<dsnname>
:url: http://www.egenix.com/
+.. deprecated:: 1.4 The mxODBC DBAPI is deprecated and will be removed
+ in a future version. Please use one of the supported DBAPIs to
+ connect to mssql.
+
Execution Modes
---------------
diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py
index d7334711b..7c2b220b4 100644
--- a/lib/sqlalchemy/dialects/mysql/oursql.py
+++ b/lib/sqlalchemy/dialects/mysql/oursql.py
@@ -19,6 +19,10 @@
and is **not tested as part of SQLAlchemy's continuous integration**.
The recommended MySQL dialects are mysqlclient and PyMySQL.
+.. deprecated:: 1.4 The OurSQL DBAPI is deprecated and will be removed
+ in a future version. Please use one of the supported DBAPIs to
+ connect to mysql.
+
Unicode
-------
@@ -68,6 +72,12 @@ class MySQLDialect_oursql(MySQLDialect):
@classmethod
def dbapi(cls):
+ util.warn_deprecated(
+ "The OurSQL DBAPI is deprecated and will be removed "
+ "in a future version. Please use one of the supported DBAPIs to "
+ "connect to mysql.",
+ version="1.4",
+ )
return __import__("oursql")
def do_execute(self, cursor, statement, parameters, context=None):
diff --git a/lib/sqlalchemy/dialects/postgresql/pygresql.py b/lib/sqlalchemy/dialects/postgresql/pygresql.py
index 8666f4172..8dbd23fe9 100644
--- a/lib/sqlalchemy/dialects/postgresql/pygresql.py
+++ b/lib/sqlalchemy/dialects/postgresql/pygresql.py
@@ -17,6 +17,10 @@
integration** and may have unresolved issues. The recommended PostgreSQL
dialect is psycopg2.
+.. deprecated:: 1.4 The pygresql DBAPI is deprecated and will be removed
+ in a future version. Please use one of the supported DBAPIs to
+ connect to PostgreSQL.
+
""" # noqa
import decimal
@@ -197,6 +201,13 @@ class PGDialect_pygresql(PGDialect):
def dbapi(cls):
import pgdb
+ util.warn_deprecated(
+ "The pygresql DBAPI is deprecated and will be removed "
+ "in a future version. Please use one of the supported DBAPIs to "
+ "connect to PostgreSQL.",
+ version="1.4",
+ )
+
return pgdb
colspecs = util.update_copy(
diff --git a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
index 289a9a097..bd015a5b8 100644
--- a/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
+++ b/lib/sqlalchemy/dialects/postgresql/pypostgresql.py
@@ -17,6 +17,13 @@
integration** and may have unresolved issues. The recommended PostgreSQL
driver is psycopg2.
+.. deprecated:: 1.4 The py-postgresql DBAPI is deprecated and will be removed
+ in a future version. This DBAPI is superseded by the external
+ version available at external-dialect_. Please use the external version or
+ one of the supported DBAPIs to connect to PostgreSQL.
+
+.. TODO update link
+.. _external-dialect: https://github.com/PyGreSQL
""" # noqa
@@ -69,6 +76,15 @@ class PGDialect_pypostgresql(PGDialect):
def dbapi(cls):
from postgresql.driver import dbapi20
+ # TODO update link
+ util.warn_deprecated(
+ "The py-postgresql DBAPI is deprecated and will be removed "
+ "in a future version. This DBAPI is superseded by the external"
+ "version available at https://github.com/PyGreSQL. Please "
+ "use one of the supported DBAPIs to connect to PostgreSQL.",
+ version="1.4",
+ )
+
return dbapi20
_DBAPI_ERROR_NAMES = [
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
index 213cc55f2..8f72e12fa 100644
--- a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
+++ b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
@@ -99,6 +99,7 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite):
from pysqlcipher3 import dbapi2 as sqlcipher
except ImportError:
raise e
+
return sqlcipher
@classmethod
diff --git a/lib/sqlalchemy/dialects/sybase/base.py b/lib/sqlalchemy/dialects/sybase/base.py
index 3920aff05..634cf0da4 100644
--- a/lib/sqlalchemy/dialects/sybase/base.py
+++ b/lib/sqlalchemy/dialects/sybase/base.py
@@ -20,6 +20,9 @@
dialect is not tested within continuous integration and is likely to have
many issues and caveats not currently handled.
+.. deprecated:: 1.4 The Sybase dialect is deprecated and will be removed
+ in a future version.
+
"""
import re
@@ -648,6 +651,14 @@ class SybaseDialect(default.DefaultDialect):
construct_arguments = []
+ def __init__(self, *args, **kwargs):
+ util.warn_deprecated(
+ "The Sybase dialect is deprecated and will be removed "
+ "in a future version.",
+ version="1.4",
+ )
+ super(SybaseDialect, self).__init__(*args, **kwargs)
+
def _get_default_schema_name(self, connection):
return connection.scalar(
text("SELECT user_name() as user_name").columns(username=Unicode)
diff --git a/lib/sqlalchemy/dialects/sybase/mxodbc.py b/lib/sqlalchemy/dialects/sybase/mxodbc.py
index 12dcc2cf7..d23482357 100644
--- a/lib/sqlalchemy/dialects/sybase/mxodbc.py
+++ b/lib/sqlalchemy/dialects/sybase/mxodbc.py
@@ -16,7 +16,6 @@
This dialect is a stub only and is likely non functional at this time.
-
"""
from sqlalchemy.connectors.mxodbc import MxODBCConnector
from sqlalchemy.dialects.sybase.base import SybaseDialect
diff --git a/lib/sqlalchemy/dialects/sybase/pyodbc.py b/lib/sqlalchemy/dialects/sybase/pyodbc.py
index ff166feb1..d11aae1c5 100644
--- a/lib/sqlalchemy/dialects/sybase/pyodbc.py
+++ b/lib/sqlalchemy/dialects/sybase/pyodbc.py
@@ -12,7 +12,6 @@
:connectstring: sybase+pyodbc://<username>:<password>@<dsnname>[/<database>]
:url: http://pypi.python.org/pypi/pyodbc/
-
Unicode Support
---------------
@@ -81,5 +80,9 @@ class SybaseDialect_pyodbc(PyODBCConnector, SybaseDialect):
colspecs = {sqltypes.Numeric: _SybNumeric_pyodbc}
+ @classmethod
+ def dbapi(cls):
+ return PyODBCConnector.dbapi()
+
dialect = SybaseDialect_pyodbc