From: Mike Bayer Date: Sun, 24 Mar 2013 17:50:56 +0000 (-0400) Subject: Loosened the check on dialect-specific argument names X-Git-Tag: rel_0_8_1~26^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4703917d82a7100ff91d938c0592e39dd757a64;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Loosened the check on dialect-specific argument names passed to Table(); since we want to support external dialects and also want to support args without a certain dialect being installed, it only checks the format of the arg now, rather than looking for that dialect in sqlalchemy.dialects. --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index b59ad07f7c..d48b7080c5 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -6,6 +6,15 @@ .. changelog:: :version: 0.8.1 + .. change:: + :tags: feature, sql + + Loosened the check on dialect-specific argument names + passed to Table(); since we want to support external dialects + and also want to support args without a certain dialect + being installed, it only checks the format of the arg now, + rather than looking for that dialect in sqlalchemy.dialects. + .. change:: :tags: bug, sql diff --git a/lib/sqlalchemy/dialects/__init__.py b/lib/sqlalchemy/dialects/__init__.py index fbbff153c3..7f5d347077 100644 --- a/lib/sqlalchemy/dialects/__init__.py +++ b/lib/sqlalchemy/dialects/__init__.py @@ -18,7 +18,6 @@ __all__ = ( from .. import util - def _auto_fn(name): """default dialect importer. diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 01a763ca1b..9a07b9de41 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -93,14 +93,13 @@ def _get_table_key(name, schema): def _validate_dialect_kwargs(kwargs, name): # validate remaining kwargs that they all specify DB prefixes - if len([k for k in kwargs - if not re.match( - r'^(?:%s)_' % - '|'.join(dialects.__all__), k - ) - ]): - raise TypeError( - "Invalid argument(s) for %s: %r" % (name, kwargs.keys())) + + for k in kwargs: + m = re.match('^(.+?)_.*', k) + if m is None: + raise TypeError("Additional arguments should be " + "named _, got '%s'" % k) + inspection._self_inspects(SchemaItem)