mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-04 23:06:24 -04:00
more import cleanups
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
from sqlalchemy.dialects.mysql import base, mysqldb, oursql, \
|
||||
from . import base, mysqldb, oursql, \
|
||||
pyodbc, zxjdbc, mysqlconnector, pymysql,\
|
||||
gaerdbms
|
||||
|
||||
# default dialect
|
||||
base.dialect = mysqldb.dialect
|
||||
|
||||
from sqlalchemy.dialects.mysql.base import \
|
||||
from .base import \
|
||||
BIGINT, BINARY, BIT, BLOB, BOOLEAN, CHAR, DATE, DATETIME, \
|
||||
DECIMAL, DOUBLE, ENUM, DECIMAL,\
|
||||
FLOAT, INTEGER, INTEGER, LONGBLOB, LONGTEXT, MEDIUMBLOB, \
|
||||
|
||||
@@ -281,24 +281,25 @@ http://dev.mysql.com/doc/refman/5.0/en/create-table.html
|
||||
|
||||
"""
|
||||
|
||||
import datetime, inspect, re, sys
|
||||
import datetime
|
||||
import inspect
|
||||
import re
|
||||
import sys
|
||||
|
||||
from sqlalchemy import schema as sa_schema
|
||||
from sqlalchemy import exc, log, sql, util
|
||||
from sqlalchemy.sql import operators as sql_operators
|
||||
from sqlalchemy.sql import functions as sql_functions
|
||||
from sqlalchemy.sql import compiler
|
||||
from ... import schema as sa_schema
|
||||
from ... import exc, log, sql, util
|
||||
from ...sql import compiler
|
||||
from array import array as _array
|
||||
|
||||
from sqlalchemy.engine import reflection
|
||||
from sqlalchemy.engine import base as engine_base, default
|
||||
from sqlalchemy import types as sqltypes
|
||||
from sqlalchemy.util import topological
|
||||
from sqlalchemy.types import DATE, DATETIME, BOOLEAN, TIME, \
|
||||
from ...engine import reflection
|
||||
from ...engine import default
|
||||
from ... import types as sqltypes
|
||||
from ...util import topological
|
||||
from ...types import DATE, DATETIME, BOOLEAN, TIME, \
|
||||
BLOB, BINARY, VARBINARY
|
||||
|
||||
RESERVED_WORDS = set(
|
||||
['accessible', 'add', 'all', 'alter', 'analyze','and', 'as', 'asc',
|
||||
['accessible', 'add', 'all', 'alter', 'analyze', 'and', 'as', 'asc',
|
||||
'asensitive', 'before', 'between', 'bigint', 'binary', 'blob', 'both',
|
||||
'by', 'call', 'cascade', 'case', 'change', 'char', 'character', 'check',
|
||||
'collate', 'column', 'condition', 'constraint', 'continue', 'convert',
|
||||
|
||||
@@ -32,8 +32,8 @@ default.
|
||||
|
||||
"""
|
||||
|
||||
from sqlalchemy.dialects.mysql.mysqldb import MySQLDialect_mysqldb
|
||||
from sqlalchemy.pool import NullPool
|
||||
from .mysqldb import MySQLDialect_mysqldb
|
||||
from ...pool import NullPool
|
||||
import re
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class MySQLDialect_gaerdbms(MySQLDialect_mysqldb):
|
||||
return NullPool
|
||||
|
||||
def create_connect_args(self, url):
|
||||
return [[],{'database':url.database}]
|
||||
return [[], {'database': url.database}]
|
||||
|
||||
def _extract_error_code(self, exception):
|
||||
match = re.compile(r"^(\d+):").match(str(exception))
|
||||
|
||||
@@ -19,16 +19,11 @@ Connect string format::
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from sqlalchemy.dialects.mysql.base import (MySQLDialect,
|
||||
from .base import (MySQLDialect,
|
||||
MySQLExecutionContext, MySQLCompiler, MySQLIdentifierPreparer,
|
||||
BIT)
|
||||
|
||||
from sqlalchemy.engine import base as engine_base, default
|
||||
from sqlalchemy.sql import operators as sql_operators
|
||||
from sqlalchemy import exc, log, schema, sql, types as sqltypes, util
|
||||
from sqlalchemy import processors
|
||||
from ... import util
|
||||
|
||||
class MySQLExecutionContext_mysqlconnector(MySQLExecutionContext):
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ It is strongly advised to use the latest version of MySQL-Python.
|
||||
|
||||
"""
|
||||
|
||||
from sqlalchemy.dialects.mysql.base import (MySQLDialect, MySQLExecutionContext,
|
||||
from .base import (MySQLDialect, MySQLExecutionContext,
|
||||
MySQLCompiler, MySQLIdentifierPreparer)
|
||||
from sqlalchemy.connectors.mysqldb import (
|
||||
from ...connectors.mysqldb import (
|
||||
MySQLDBExecutionContext,
|
||||
MySQLDBCompiler,
|
||||
MySQLDBIdentifierPreparer,
|
||||
|
||||
@@ -40,12 +40,8 @@ defaults to, there is a separate parameter::
|
||||
|
||||
import re
|
||||
|
||||
from sqlalchemy.dialects.mysql.base import (BIT, MySQLDialect, MySQLExecutionContext,
|
||||
MySQLCompiler, MySQLIdentifierPreparer)
|
||||
from sqlalchemy.engine import base as engine_base, default
|
||||
from sqlalchemy.sql import operators as sql_operators
|
||||
from sqlalchemy import exc, log, schema, sql, types as sqltypes, util
|
||||
from sqlalchemy import processors
|
||||
from .base import (BIT, MySQLDialect, MySQLExecutionContext)
|
||||
from ... import types as sqltypes, util
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ the pymysql driver as well.
|
||||
|
||||
"""
|
||||
|
||||
from sqlalchemy.dialects.mysql.mysqldb import MySQLDialect_mysqldb
|
||||
from .mysqldb import MySQLDialect_mysqldb
|
||||
|
||||
class MySQLDialect_pymysql(MySQLDialect_mysqldb):
|
||||
driver = 'pymysql'
|
||||
|
||||
@@ -27,10 +27,9 @@ of OurSQL, MySQLdb, or MySQL-connector/Python.
|
||||
|
||||
"""
|
||||
|
||||
from sqlalchemy.dialects.mysql.base import MySQLDialect, MySQLExecutionContext
|
||||
from sqlalchemy.connectors.pyodbc import PyODBCConnector
|
||||
from sqlalchemy.engine import base as engine_base
|
||||
from sqlalchemy import util
|
||||
from .base import MySQLDialect, MySQLExecutionContext
|
||||
from ...connectors.pyodbc import PyODBCConnector
|
||||
from ... import util
|
||||
import re
|
||||
|
||||
class MySQLExecutionContext_pyodbc(MySQLExecutionContext):
|
||||
|
||||
@@ -31,9 +31,9 @@ overriden via a ``create_engine`` URL parameter.
|
||||
"""
|
||||
import re
|
||||
|
||||
from sqlalchemy import types as sqltypes, util
|
||||
from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
|
||||
from sqlalchemy.dialects.mysql.base import BIT, MySQLDialect, MySQLExecutionContext
|
||||
from ... import types as sqltypes, util
|
||||
from ...connectors.zxJDBC import ZxJDBCConnector
|
||||
from .base import BIT, MySQLDialect, MySQLExecutionContext
|
||||
|
||||
class _ZxJDBCBit(BIT):
|
||||
def result_processor(self, dialect, coltype):
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
from sqlalchemy.dialects.postgresql import base, psycopg2, pg8000, pypostgresql, zxjdbc
|
||||
from . import base, psycopg2, pg8000, pypostgresql, zxjdbc
|
||||
|
||||
base.dialect = psycopg2.dialect
|
||||
|
||||
from sqlalchemy.dialects.postgresql.base import \
|
||||
from .base import \
|
||||
INTEGER, BIGINT, SMALLINT, VARCHAR, CHAR, TEXT, NUMERIC, FLOAT, REAL, INET, \
|
||||
CIDR, UUID, BIT, MACADDR, DOUBLE_PRECISION, TIMESTAMP, TIME,\
|
||||
DATE, BYTEA, BOOLEAN, INTERVAL, ARRAY, ENUM, dialect
|
||||
|
||||
@@ -190,10 +190,10 @@ version of PostgreSQL.
|
||||
|
||||
import re
|
||||
|
||||
from sqlalchemy import sql, schema, exc, util
|
||||
from sqlalchemy.engine import default, reflection
|
||||
from sqlalchemy.sql import compiler, expression, util as sql_util
|
||||
from sqlalchemy import types as sqltypes
|
||||
from ... import sql, schema, exc, util
|
||||
from ...engine import default, reflection
|
||||
from ...sql import compiler, expression, util as sql_util
|
||||
from ... import types as sqltypes
|
||||
|
||||
try:
|
||||
from uuid import UUID as _python_UUID
|
||||
|
||||
@@ -27,11 +27,11 @@ Passing data from/to the Interval type is not supported as of
|
||||
yet.
|
||||
|
||||
"""
|
||||
from sqlalchemy import util, exc
|
||||
from sqlalchemy.util.compat import decimal
|
||||
from sqlalchemy import processors
|
||||
from sqlalchemy import types as sqltypes
|
||||
from sqlalchemy.dialects.postgresql.base import PGDialect, \
|
||||
from ... import util, exc
|
||||
from ...util.compat import decimal
|
||||
from ... import processors
|
||||
from ... import types as sqltypes
|
||||
from .base import PGDialect, \
|
||||
PGCompiler, PGIdentifierPreparer, PGExecutionContext,\
|
||||
_DECIMAL_TYPES, _FLOAT_TYPES, _INT_TYPES
|
||||
|
||||
|
||||
@@ -144,13 +144,13 @@ The psycopg2 dialect will log Postgresql NOTICE messages via the
|
||||
import re
|
||||
import logging
|
||||
|
||||
from sqlalchemy import util, exc
|
||||
from sqlalchemy.util.compat import decimal
|
||||
from sqlalchemy import processors
|
||||
from sqlalchemy.engine import base
|
||||
from sqlalchemy.sql import expression
|
||||
from sqlalchemy import types as sqltypes
|
||||
from sqlalchemy.dialects.postgresql.base import PGDialect, PGCompiler, \
|
||||
from ... import util, exc
|
||||
from ...util.compat import decimal
|
||||
from ... import processors
|
||||
from ...engine import base
|
||||
from ...sql import expression
|
||||
from ... import types as sqltypes
|
||||
from .base import PGDialect, PGCompiler, \
|
||||
PGIdentifierPreparer, PGExecutionContext, \
|
||||
ENUM, ARRAY, _DECIMAL_TYPES, _FLOAT_TYPES,\
|
||||
_INT_TYPES
|
||||
|
||||
@@ -13,10 +13,10 @@ URLs are of the form ``postgresql+pypostgresql://user:password@host:port/dbname[
|
||||
|
||||
|
||||
"""
|
||||
from sqlalchemy import util
|
||||
from sqlalchemy import types as sqltypes
|
||||
from sqlalchemy.dialects.postgresql.base import PGDialect, PGExecutionContext
|
||||
from sqlalchemy import processors
|
||||
from ... import util
|
||||
from ... import types as sqltypes
|
||||
from .base import PGDialect, PGExecutionContext
|
||||
from ... import processors
|
||||
|
||||
class PGNumeric(sqltypes.Numeric):
|
||||
def bind_processor(self, dialect):
|
||||
|
||||
@@ -12,8 +12,8 @@ JDBC Driver
|
||||
The official Postgresql JDBC driver is at http://jdbc.postgresql.org/.
|
||||
|
||||
"""
|
||||
from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
|
||||
from sqlalchemy.dialects.postgresql.base import PGDialect, PGExecutionContext
|
||||
from ...connectors.zxJDBC import ZxJDBCConnector
|
||||
from .base import PGDialect, PGExecutionContext
|
||||
|
||||
class PGExecutionContext_zxjdbc(PGExecutionContext):
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ url.py
|
||||
# not sure what this was used for
|
||||
#import sqlalchemy.databases
|
||||
|
||||
from sqlalchemy.engine.base import (
|
||||
from .base import (
|
||||
BufferedColumnResultProxy,
|
||||
BufferedColumnRow,
|
||||
BufferedRowResultProxy,
|
||||
@@ -71,8 +71,8 @@ from sqlalchemy.engine.base import (
|
||||
TwoPhaseTransaction,
|
||||
TypeCompiler
|
||||
)
|
||||
from sqlalchemy.engine import strategies
|
||||
from sqlalchemy import util
|
||||
from . import strategies
|
||||
from .. import util
|
||||
|
||||
|
||||
__all__ = (
|
||||
|
||||
@@ -14,18 +14,18 @@ and result contexts.
|
||||
|
||||
__all__ = [
|
||||
'BufferedColumnResultProxy', 'BufferedColumnRow',
|
||||
'BufferedRowResultProxy','Compiled', 'Connectable', 'Connection',
|
||||
'Dialect', 'Engine','ExecutionContext', 'NestedTransaction',
|
||||
'ResultProxy', 'RootTransaction','RowProxy', 'SchemaIterator',
|
||||
'BufferedRowResultProxy', 'Compiled', 'Connectable', 'Connection',
|
||||
'Dialect', 'Engine', 'ExecutionContext', 'NestedTransaction',
|
||||
'ResultProxy', 'RootTransaction', 'RowProxy',
|
||||
'StringIO', 'Transaction', 'TwoPhaseTransaction',
|
||||
'connection_memoize']
|
||||
|
||||
import inspect, StringIO, sys, operator
|
||||
import StringIO
|
||||
import sys
|
||||
from itertools import izip, chain
|
||||
from sqlalchemy import exc, schema, util, types, log, interfaces, \
|
||||
from .. import exc, schema, util, types, log, interfaces, \
|
||||
event, events
|
||||
from sqlalchemy.sql import expression, util as sql_util
|
||||
from sqlalchemy import processors
|
||||
from ..sql import expression, util as sql_util
|
||||
import collections
|
||||
|
||||
class Dialect(object):
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
"""Routines to handle CREATE/DROP workflow."""
|
||||
|
||||
from sqlalchemy import engine, schema
|
||||
from sqlalchemy.sql import util as sql_util
|
||||
from .. import schema
|
||||
from ..sql import util as sql_util
|
||||
|
||||
|
||||
class DDLBase(schema.SchemaVisitor):
|
||||
|
||||
@@ -12,10 +12,11 @@ as the base class for their own corresponding classes.
|
||||
|
||||
"""
|
||||
|
||||
import re, random
|
||||
from sqlalchemy.engine import base, reflection
|
||||
from sqlalchemy.sql import compiler, expression
|
||||
from sqlalchemy import exc, types as sqltypes, util, pool, processors
|
||||
import re
|
||||
import random
|
||||
from . import base, reflection
|
||||
from ..sql import compiler, expression
|
||||
from .. import exc, types as sqltypes, util, pool, processors
|
||||
import codecs
|
||||
import weakref
|
||||
|
||||
|
||||
@@ -24,15 +24,14 @@ methods such as get_table_names, get_columns, etc.
|
||||
'name' attribute..
|
||||
"""
|
||||
|
||||
import sqlalchemy
|
||||
from sqlalchemy import exc, sql
|
||||
from sqlalchemy import schema as sa_schema
|
||||
from sqlalchemy import util
|
||||
from sqlalchemy.types import TypeEngine
|
||||
from sqlalchemy.util import deprecated
|
||||
from sqlalchemy.util import topological
|
||||
from sqlalchemy import inspection
|
||||
from sqlalchemy.engine.base import Connectable
|
||||
from .. import exc, sql
|
||||
from .. import schema as sa_schema
|
||||
from .. import util
|
||||
from ..types import TypeEngine
|
||||
from ..util import deprecated
|
||||
from ..util import topological
|
||||
from .. import inspection
|
||||
from .base import Connectable
|
||||
|
||||
@util.decorator
|
||||
def cache(fn, self, con, *args, **kw):
|
||||
|
||||
@@ -12,9 +12,10 @@ with a string argument; alternatively, the URL is a public-facing construct whic
|
||||
be used directly and is also accepted directly by ``create_engine()``.
|
||||
"""
|
||||
|
||||
import re, urllib
|
||||
from sqlalchemy import exc, util
|
||||
from sqlalchemy.engine import base
|
||||
import re
|
||||
import urllib
|
||||
from .. import exc, util
|
||||
from . import base
|
||||
|
||||
|
||||
class URL(object):
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
from compat import callable, cmp, reduce, defaultdict, py25_dict, \
|
||||
from .compat import callable, cmp, reduce, defaultdict, py25_dict, \
|
||||
threading, py3k_warning, jython, pypy, win32, set_types, buffer, pickle, \
|
||||
update_wrapper, partial, md5_hex, decode_slice, dottedgetter,\
|
||||
parse_qsl, any, contextmanager, namedtuple, next, WeakSet
|
||||
|
||||
from _collections import KeyedTuple, ImmutableContainer, immutabledict, \
|
||||
from ._collections import KeyedTuple, ImmutableContainer, immutabledict, \
|
||||
Properties, OrderedProperties, ImmutableProperties, OrderedDict, \
|
||||
OrderedSet, IdentitySet, OrderedIdentitySet, column_set, \
|
||||
column_dict, ordered_column_set, populate_column_dict, unique_list, \
|
||||
@@ -17,7 +17,7 @@ from _collections import KeyedTuple, ImmutableContainer, immutabledict, \
|
||||
to_column_set, update_copy, flatten_iterator, \
|
||||
LRUCache, ScopedRegistry, ThreadLocalRegistry, WeakSequence
|
||||
|
||||
from langhelpers import iterate_attributes, class_hierarchy, \
|
||||
from .langhelpers import iterate_attributes, class_hierarchy, \
|
||||
portable_instancemethod, unbound_method_to_callable, \
|
||||
getargspec_init, format_argspec_init, format_argspec_plus, \
|
||||
get_func_kwargs, get_cls_kwargs, decorator, as_interface, \
|
||||
@@ -29,6 +29,6 @@ from langhelpers import iterate_attributes, class_hierarchy, \
|
||||
constructor_copy, methods_equivalent, chop_traceback, asint,\
|
||||
generic_repr, counter, PluginLoader, hybridmethod
|
||||
|
||||
from deprecations import warn_deprecated, warn_pending_deprecation, \
|
||||
from .deprecations import warn_deprecated, warn_pending_deprecation, \
|
||||
deprecated, pending_deprecation
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ import sys
|
||||
import itertools
|
||||
import weakref
|
||||
import operator
|
||||
from langhelpers import symbol
|
||||
from compat import time_func, threading
|
||||
from .compat import threading
|
||||
|
||||
EMPTY_SET = frozenset()
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"""Helpers related to deprecation of functions, methods, classes, other
|
||||
functionality."""
|
||||
|
||||
from sqlalchemy import exc
|
||||
from .. import exc
|
||||
import warnings
|
||||
import re
|
||||
from langhelpers import decorator
|
||||
|
||||
@@ -15,9 +15,9 @@ import re
|
||||
import sys
|
||||
import types
|
||||
import warnings
|
||||
from compat import update_wrapper, set_types, threading, \
|
||||
callable, inspect_getfullargspec, py3k_warning
|
||||
from sqlalchemy import exc
|
||||
from .compat import update_wrapper, set_types, threading, \
|
||||
callable, inspect_getfullargspec
|
||||
from .. import exc
|
||||
|
||||
def _unique_symbols(used, *bases):
|
||||
used = set(used)
|
||||
|
||||
@@ -24,7 +24,7 @@ within QueuePool.
|
||||
|
||||
from collections import deque
|
||||
from time import time as _time
|
||||
from sqlalchemy.util import threading
|
||||
from .compat import threading
|
||||
import sys
|
||||
|
||||
if sys.version_info < (2, 6):
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
|
||||
"""Topological sorting algorithms."""
|
||||
|
||||
from sqlalchemy.exc import CircularDependencyError
|
||||
from sqlalchemy import util
|
||||
|
||||
from ..exc import CircularDependencyError
|
||||
from .. import util
|
||||
|
||||
__all__ = ['sort', 'sort_as_subsets', 'find_cycles']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user