--- /dev/null
+.. change::
+ :tags: bug, performance
+ :tickets: 5180
+
+ Revised an internal change to the test system added as a result of
+ :ticket:`5085` where a testing-related module per dialect would be loaded
+ unconditionally upon making use of that dialect, pulling in SQLAlchemy's
+ testing framework as well as the ORM into the module import space. This
+ would only impact initial startup time and memory to a modest extent,
+ however it's best that these additional modules aren't reverse-dependent on
+ straight Core usage.
from . import adodbapi # noqa
from . import base # noqa
from . import mxodbc # noqa
-from . import provision # noqa
from . import pymssql # noqa
from . import pyodbc # noqa
from .base import BIGINT
from . import mysqlconnector # noqa
from . import mysqldb # noqa
from . import oursql # noqa
-from . import provision # noqa
from . import pymysql # noqa
from . import pyodbc # noqa
from .base import BIGINT
from . import base # noqa
from . import cx_oracle # noqa
-from . import provision # noqa
from .base import BFILE
from .base import BINARY_DOUBLE
from .base import BINARY_FLOAT
from . import base
from . import pg8000 # noqa
-from . import provision # noqa
from . import psycopg2 # noqa
from . import psycopg2cffi # noqa
from . import pygresql # noqa
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import base # noqa
-from . import provision # noqa
from . import pysqlcipher # noqa
from . import pysqlite # noqa
from .base import BLOB
def get_pool_class(cls, url):
return getattr(cls, "poolclass", pool.QueuePool)
+ @classmethod
+ def load_provisioning(cls):
+ package = ".".join(cls.__module__.split(".")[0:-1])
+ try:
+ __import__(package + ".provision")
+ except ImportError:
+ pass
+
def initialize(self, connection):
try:
self.server_version_info = self._get_server_version_info(
"""
return cls
+ @classmethod
+ def load_provisioning(cls):
+ """set up the provision.py module for this dialect.
+
+ For dialects that include a provision.py module that sets up
+ provisioning followers, this method should initiate that process.
+
+ A typical implementation would be::
+
+ @classmethod
+ def load_provisioning(cls):
+ __import__("mydialect.provision")
+
+ The default method assumes a module named ``provision.py`` inside
+ the owning package of the current dialect, based on the ``__module__``
+ attribute::
+
+ @classmethod
+ def load_provisioning(cls):
+ package = ".".join(cls.__module__.split(".")[0:-1])
+ try:
+ __import__(package + ".provision")
+ except ImportError:
+ pass
+
+ .. versionadded:: 1.3.14
+
+ """
+
@classmethod
def engine_created(cls, engine):
"""A convenience hook called before returning the final :class:`.Engine`.
from ..sql.selectable import ForUpdateArg
from ..util import collections_abc
-
__all__ = ["Query", "QueryContext", "aliased"]
from .exclusions import db_spec
from .util import fail
from .. import exc as sa_exc
-from .. import orm
from .. import schema
from .. import types as sqltypes
from .. import util
if render_postcompile:
compile_kwargs["render_postcompile"] = True
+ from sqlalchemy import orm
+
if isinstance(clause, orm.Query):
context = clause._compile_context()
context.statement.use_labels = True
from ..engine import url as sa_url
from ..util import compat
-
log = logging.getLogger(__name__)
FOLLOWER_IDENT = None
# load the dialect, which should also have it set up its provision
# hooks
- sa_url.make_url(db_url).get_dialect()
+ dialect = sa_url.make_url(db_url).get_dialect()
+ dialect.load_provisioning()
+
if follower_ident:
db_url = follower_url_from_main(db_url, follower_ident)
db_opts = {}