]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixed the illegal_initial_chars collection + unit test, [ticket:1659]
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 21 Jan 2010 15:56:23 +0000 (15:56 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 21 Jan 2010 15:56:23 +0000 (15:56 +0000)
lib/sqlalchemy/sql/compiler.py
test/sql/test_quote.py

index c3ef9288a38f20daed37ecfe0f5a25e016f34532..2d099e9d5416e2f55ccf9ed383a81acb27903295 100644 (file)
@@ -47,7 +47,7 @@ RESERVED_WORDS = set([
     'using', 'verbose', 'when', 'where'])
 
 LEGAL_CHARACTERS = re.compile(r'^[A-Z0-9_$]+$', re.I)
-ILLEGAL_INITIAL_CHARACTERS = set(xrange(0, 10)).union(['$'])
+ILLEGAL_INITIAL_CHARACTERS = set([str(x) for x in xrange(0, 10)]).union(['$'])
 
 BIND_PARAMS = re.compile(r'(?<![:\w\$\x5c]):([\w\$]+)(?![:\w\$])', re.UNICODE)
 BIND_PARAMS_ESC = re.compile(r'\x5c(:[\w\$]+)(?![:\w\$])', re.UNICODE)
index 3198a07af4350b9b6a0c80f95a7f5f4006df511c..f4df98b9e868a2904220940d8d23f1cddeba328b 100644 (file)
@@ -1,9 +1,8 @@
 from sqlalchemy import *
-from sqlalchemy import sql
+from sqlalchemy import sql, schema
 from sqlalchemy.sql import compiler
 from sqlalchemy.test import *
 
-
 class QuoteTest(TestBase, AssertsCompiledSQL):
     @classmethod
     def setup_class(cls):
@@ -49,6 +48,14 @@ class QuoteTest(TestBase, AssertsCompiledSQL):
         print res2
         assert(res2==[(1,2,3),(2,2,3),(4,3,2)])
 
+    def test_numeric(self):
+        metadata = MetaData()
+        t1 = Table('35table', metadata,
+            Column('25column', Integer))
+        self.assert_compile(schema.CreateTable(t1), 'CREATE TABLE "35table" ('
+            '"25column" INTEGER'
+            ')'
+        )
     def testreflect(self):
         meta2 = MetaData(testing.db)
         t2 = Table('WorstCase2', meta2, autoload=True, quote=True)