]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Loosened the check on dialect-specific argument names
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 Mar 2013 17:50:56 +0000 (13:50 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 Mar 2013 17:50:56 +0000 (13:50 -0400)
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.

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/__init__.py
lib/sqlalchemy/schema.py

index b59ad07f7c8c00d33b3d39d413551ce28fb240c6..d48b7080c5792d18da9ded4634a07cbb1ea0f814 100644 (file)
@@ -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
 
index fbbff153c3d40eb3b0826738ff7abef1b6ce1616..7f5d34707771377fbd112c9eb3e6e7b7d390e314 100644 (file)
@@ -18,7 +18,6 @@ __all__ = (
 
 from .. import util
 
-
 def _auto_fn(name):
     """default dialect importer.
 
index 01a763ca1b33843f44dfd4ef8579da0e7039c8ee..9a07b9de4177a3df153ddafc47db8db3fee87af1 100644 (file)
@@ -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 <dialectname>_<argument>, got '%s'" % k)
+
 
 inspection._self_inspects(SchemaItem)