]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
all sql + engine + reflection tests passing for oracle
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jul 2009 18:20:45 +0000 (18:20 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jul 2009 18:20:45 +0000 (18:20 +0000)
13 files changed:
06CHANGES
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/test/schema.py
lib/sqlalchemy/test/testing.py
lib/sqlalchemy/types.py
test/dialect/test_oracle.py
test/engine/test_execute.py
test/engine/test_pool.py
test/engine/test_reflection.py
test/sql/test_labels.py
test/sql/test_types.py

index 6e717f13b7f9d53103f8def7e00b584e3b81b2d5..13b233fc8f22a980bde18dc05b0afd6919c28ba0 100644 (file)
--- a/06CHANGES
+++ b/06CHANGES
 - mysql
     - all the _detect_XXX() functions now run once underneath dialect.initialize()
     
+- oracle
+    - support for cx_Oracle's "native unicode" mode which does not require NLS_LANG
+      to be set.  Use the latest 5.0.2 or later of cx_oracle.  
+    - an NCLOB type is added to the base types.
+    
 - new dialects
     - pg8000
     - pyodbc+mysql
index 4bc664b5064cfea04731965ca49a54a5cb8da9a5..38e81110cd3ecfb201919e06672b60e199d372f3 100644 (file)
@@ -44,6 +44,32 @@ This step is also required when using table reflection, i.e. autoload=True::
         autoload=True
   ) 
 
+Identifier Casing
+-----------------
+
+In Oracle, the data dictionary represents all case insensitive identifier names 
+using UPPERCASE text.   SQLAlchemy on the other hand considers an all-lower case identifier
+name to be case insensitive.   The Oracle dialect converts all case insensitive identifiers
+to and from those two formats during schema level communication, such as reflection of
+tables and indexes.   Using an UPPERCASE name on the SQLAlchemy side indicates a 
+case sensitive identifier, and SQLAlchemy will quote the name - this will cause mismatches
+against data dictionary data received from Oracle, so unless identifier names have been
+truly created as case sensitive (i.e. using quoted names), all lowercase names should be
+used on the SQLAlchemy side.
+
+Unicode
+-------
+
+SQLAlchemy 0.6 uses the "native unicode" mode provided as of cx_oracle 5.  cx_oracle 5.0.2
+or greater is recommended for support of NCLOB.   If not using cx_oracle 5, the NLS_LANG
+environment variable needs to be set in order for the oracle client library to use 
+proper encoding, such as "AMERICAN_AMERICA.UTF8".
+
+Also note that Oracle supports unicode data through the NVARCHAR and NCLOB data types.
+When using the SQLAlchemy Unicode and UnicodeText types, these DDL types will be used
+within CREATE TABLE statements.   Usage of VARCHAR2 and CLOB with unicode text still 
+requires NLS_LANG to be set.
+
 LIMIT/OFFSET Support
 --------------------
 
@@ -72,7 +98,7 @@ is not in use this flag should be left off.
 
 """
 
-import datetime, random, re
+import random, re
 
 from sqlalchemy import schema as sa_schema
 from sqlalchemy import util, sql, log
@@ -83,90 +109,8 @@ from sqlalchemy import types as sqltypes
 
 RESERVED_WORDS = set('''SHARE RAW DROP BETWEEN FROM DESC OPTION PRIOR LONG THEN DEFAULT ALTER IS INTO MINUS INTEGER NUMBER GRANT IDENTIFIED ALL TO ORDER ON FLOAT DATE HAVING CLUSTER NOWAIT RESOURCE ANY TABLE INDEX FOR UPDATE WHERE CHECK SMALLINT WITH DELETE BY ASC REVOKE LIKE SIZE RENAME NOCOMPRESS NULL GROUP VALUES AS IN VIEW EXCLUSIVE COMPRESS SYNONYM SELECT INSERT EXISTS NOT TRIGGER ELSE CREATE INTERSECT PCTFREE DISTINCT CONNECT SET MODE OF UNIQUE VARCHAR2 VARCHAR LOCK OR CHAR DECIMAL UNION PUBLIC AND START'''.split()) 
 
-class OracleDate(sqltypes.Date):
-    def bind_processor(self, dialect):
-        return None
-
-    def result_processor(self, dialect):
-        def process(value):
-            if not isinstance(value, datetime.datetime):
-                return value
-            else:
-                return value.date()
-        return process
-
-class OracleDateTime(sqltypes.DateTime):
-    def result_processor(self, dialect):
-        def process(value):
-            if value is None or isinstance(value, datetime.datetime):
-                return value
-            else:
-                # convert cx_oracle datetime object returned pre-python 2.4
-                return datetime.datetime(value.year, value.month,
-                    value.day,value.hour, value.minute, value.second)
-        return process
-
-# Note:
-# Oracle DATE == DATETIME
-# Oracle does not allow milliseconds in DATE
-# Oracle does not support TIME columns
-
-# only if cx_oracle contains TIMESTAMP
-class OracleTimestamp(sqltypes.TIMESTAMP):
-    def result_processor(self, dialect):
-        def process(value):
-            if value is None or isinstance(value, datetime.datetime):
-                return value
-            else:
-                # convert cx_oracle datetime object returned pre-python 2.4
-                return datetime.datetime(value.year, value.month,
-                    value.day,value.hour, value.minute, value.second)
-        return process
-
-class OracleText(sqltypes.Text):
-    def get_dbapi_type(self, dbapi):
-        return dbapi.CLOB
-
-    def result_processor(self, dialect):
-        super_process = super(OracleText, self).result_processor(dialect)
-        if not dialect.auto_convert_lobs:
-            return super_process
-        lob = dialect.dbapi.LOB
-        def process(value):
-            if isinstance(value, lob):
-                if super_process:
-                    return super_process(value.read())
-                else:
-                    return value.read()
-            else:
-                if super_process:
-                    return super_process(value)
-                else:
-                    return value
-        return process
-
-
-class OracleBinary(sqltypes.Binary):
-    def get_dbapi_type(self, dbapi):
-        return dbapi.BLOB
-
-    def bind_processor(self, dialect):
-        return None
-
-    def result_processor(self, dialect):
-        if not dialect.auto_convert_lobs:
-            return None
-        lob = dialect.dbapi.LOB
-        def process(value):
-            if isinstance(value, lob):
-                return value.read()
-            else:
-                return value
-        return process
-
-class OracleRaw(OracleBinary):
-    def get_col_spec(self):
-        return "RAW(%(length)s)" % {'length' : self.length}
+class OracleRaw(sqltypes.Binary):
+    pass
 
 class OracleBoolean(sqltypes.Boolean):
     def result_processor(self, dialect):
@@ -189,12 +133,7 @@ class OracleBoolean(sqltypes.Boolean):
         return process
 
 colspecs = {
-    sqltypes.DateTime : OracleDateTime,
-    sqltypes.Date : OracleDate,
-    sqltypes.Binary : OracleBinary,
     sqltypes.Boolean : OracleBoolean,
-    sqltypes.Text : OracleText,
-    sqltypes.TIMESTAMP : OracleTimestamp,
 }
 
 ischema_names = {
@@ -223,6 +162,12 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler):
     
     def visit_datetime(self, type_):
         return self.visit_DATE(type_)
+    
+    def visit_float(self, type_):
+        return "NUMERIC(%(precision)s, %(scale)s)" % {'precision': type_.precision, 'scale' : 2}
+    
+    def visit_unicode(self, type_):
+        return self.visit_NVARCHAR(type_)
         
     def visit_VARCHAR(self, type_):
         return "VARCHAR(%(length)s)" % {'length' : type_.length}
@@ -233,6 +178,9 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler):
     def visit_text(self, type_):
         return self.visit_CLOB(type_)
 
+    def visit_unicode_text(self, type_):
+        return self.visit_NCLOB(type_)
+
     def visit_binary(self, type_):
         return self.visit_BLOB(type_)
     
@@ -319,7 +267,10 @@ class OracleCompiler(compiler.SQLCompiler):
         """Oracle doesn't like ``FROM table AS alias``.  Is the AS standard SQL??"""
 
         if asfrom:
-            return self.process(alias.original, asfrom=asfrom, **kwargs) + " " + self.preparer.format_alias(alias, self._anonymize(alias.name))
+            alias_name = isinstance(alias.name, expression._generated_label) and \
+                            self._truncated_identifier("alias", alias.name) or alias.name
+            
+            return self.process(alias.original, asfrom=asfrom, **kwargs) + " " + self.preparer.format_alias(alias, alias_name)
         else:
             return self.process(alias.original, **kwargs)
 
@@ -627,7 +578,7 @@ class OracleDialect(default.DefaultDialect):
             if coltype == 'NUMBER' :
                 if precision is None and scale is None:
                     coltype = sqltypes.NUMERIC
-                elif precision is None and scale == 0  :
+                elif precision is None and scale == 0:
                     coltype = sqltypes.INTEGER
                 else :
                     coltype = sqltypes.NUMERIC(precision, scale)
@@ -687,10 +638,10 @@ class OracleDialect(default.DefaultDialect):
             if rset.column_name in [s.upper() for s in pkeys]:
                 continue
             if rset.index_name != last_index_name:
-                index = dict(name=rset.index_name, column_names=[])
+                index = dict(name=self._normalize_name(rset.index_name), column_names=[])
                 indexes.append(index)
             index['unique'] = uniqueness.get(rset.uniqueness, False)
-            index['column_names'].append(rset.column_name)
+            index['column_names'].append(self._normalize_name(rset.column_name))
             last_index_name = rset.index_name
         return indexes
 
index b899d4438d6872d41632fd5b37198a32c9246af6..fb5662bd12167329c8658a424a2f6398e1a3a274 100644 (file)
@@ -63,17 +63,101 @@ working successfully but this should be regarded as an experimental feature.
 
 """
 
-from sqlalchemy.dialects.oracle.base import OracleDialect, OracleText, OracleBinary, OracleRaw, RESERVED_WORDS
+from sqlalchemy.dialects.oracle.base import OracleDialect, OracleRaw, OracleBoolean, RESERVED_WORDS
 from sqlalchemy.engine.default import DefaultExecutionContext
 from sqlalchemy.engine import base
 from sqlalchemy import types as sqltypes, util
+import datetime
 
-class OracleNVarchar(sqltypes.NVARCHAR):
-    """The SQL NVARCHAR type."""
+class OracleDate(sqltypes.Date):
+    def bind_processor(self, dialect):
+        return None
 
-    def __init__(self, **kw):
-        kw['convert_unicode'] = False  # cx_oracle does this for us, for NVARCHAR2
-        sqltypes.NVARCHAR.__init__(self, **kw)
+    def result_processor(self, dialect):
+        def process(value):
+            if not isinstance(value, datetime.datetime):
+                return value
+            else:
+                return value.date()
+        return process
+
+class OracleDateTime(sqltypes.DateTime):
+    def result_processor(self, dialect):
+        def process(value):
+            if value is None or isinstance(value, datetime.datetime):
+                return value
+            else:
+                # convert cx_oracle datetime object returned pre-python 2.4
+                return datetime.datetime(value.year, value.month,
+                    value.day,value.hour, value.minute, value.second)
+        return process
+
+# Note:
+# Oracle DATE == DATETIME
+# Oracle does not allow milliseconds in DATE
+# Oracle does not support TIME columns
+
+# only if cx_oracle contains TIMESTAMP
+class OracleTimestamp(sqltypes.TIMESTAMP):
+    def result_processor(self, dialect):
+        def process(value):
+            if value is None or isinstance(value, datetime.datetime):
+                return value
+            else:
+                # convert cx_oracle datetime object returned pre-python 2.4
+                return datetime.datetime(value.year, value.month,
+                    value.day,value.hour, value.minute, value.second)
+        return process
+
+class LOBMixin(object):
+    def result_processor(self, dialect):
+        super_process = super(LOBMixin, self).result_processor(dialect)
+        if not dialect.auto_convert_lobs:
+            return super_process
+        lob = dialect.dbapi.LOB
+        def process(value):
+            if isinstance(value, lob):
+                if super_process:
+                    return super_process(value.read())
+                else:
+                    return value.read()
+            else:
+                if super_process:
+                    return super_process(value)
+                else:
+                    return value
+        return process
+    
+class OracleText(LOBMixin, sqltypes.Text):
+    def get_dbapi_type(self, dbapi):
+        return dbapi.CLOB
+
+class OracleUnicodeText(LOBMixin, sqltypes.UnicodeText):
+    def get_dbapi_type(self, dbapi):
+        return dbapi.NCLOB
+
+
+class OracleBinary(LOBMixin, sqltypes.Binary):
+    def get_dbapi_type(self, dbapi):
+        return dbapi.BLOB
+
+    def bind_processor(self, dialect):
+        return None
+
+
+class cxOracleRaw(LOBMixin, OracleRaw):
+    pass
+
+
+colspecs = {
+    sqltypes.DateTime : OracleDateTime,
+    sqltypes.Date : OracleDate,
+    sqltypes.Binary : OracleBinary,
+    sqltypes.Boolean : OracleBoolean,
+    sqltypes.Text : OracleText,
+    sqltypes.UnicodeText : OracleUnicodeText,
+    sqltypes.TIMESTAMP : OracleTimestamp,
+}
 
 class Oracle_cx_oracleExecutionContext(DefaultExecutionContext):
     def pre_exec(self):
@@ -134,13 +218,7 @@ class Oracle_cx_oracleExecutionContext(DefaultExecutionContext):
 class Oracle_cx_oracle(OracleDialect):
     execution_ctx_cls = Oracle_cx_oracleExecutionContext
     driver = "cx_oracle"
-    
-    colspecs = util.update_copy(
-        OracleDialect.colspecs,
-        {
-            sqltypes.NVARCHAR:OracleNVarchar
-        }
-    )
+    colspecs = colspecs
     
     def __init__(self, 
                 auto_setinputsizes=True, 
@@ -155,6 +233,14 @@ class Oracle_cx_oracle(OracleDialect):
         self.supports_timestamp = self.dbapi is None or hasattr(self.dbapi, 'TIMESTAMP' )
         self.auto_setinputsizes = auto_setinputsizes
         self.auto_convert_lobs = auto_convert_lobs
+        
+        def vers(num):
+            return tuple([int(x) for x in num.split('.')])
+
+        if hasattr(self.dbapi, 'version'):
+            cx_oracle_ver = vers(self.dbapi.version)
+            self.supports_unicode_binds = cx_oracle_ver >= (5, 0)
+            
         if self.dbapi is None or not self.auto_convert_lobs or not 'CLOB' in self.dbapi.__dict__:
             self.dbapi_type_map = {}
             self.ORACLE_BINARY_TYPES = []
@@ -164,6 +250,7 @@ class Oracle_cx_oracle(OracleDialect):
             # expect encoded strings or unicodes, etc.
             self.dbapi_type_map = {
                 self.dbapi.CLOB: OracleText(),
+                self.dbapi.NCLOB:OracleUnicodeText(),
                 self.dbapi.BLOB: OracleBinary(),
                 self.dbapi.BINARY: OracleRaw(),
             }
index 1a88680478fa9888f0b1603ff2d092ee395fb4ec..e984ca68c2f9d511c2db5afcc31c7fccba7e9ab6 100644 (file)
@@ -1080,6 +1080,9 @@ class GenericTypeCompiler(engine.TypeCompiler):
     def visit_CLOB(self, type_):
         return "CLOB"
 
+    def visit_NCLOB(self, type_):
+        return "NCLOB"
+
     def visit_VARCHAR(self, type_):
         return "VARCHAR" + (type_.length and "(%d)" % type_.length or "")
 
@@ -1119,7 +1122,7 @@ class GenericTypeCompiler(engine.TypeCompiler):
     def visit_integer(self, type_): 
         return self.visit_INTEGER(type_)
         
-    def visit_float(self, type_): 
+    def visit_float(self, type_):
         return self.visit_FLOAT(type_)
         
     def visit_numeric(self, type_): 
@@ -1128,8 +1131,14 @@ class GenericTypeCompiler(engine.TypeCompiler):
     def visit_string(self, type_): 
         return self.visit_VARCHAR(type_)
         
+    def visit_unicode(self, type_): 
+        return self.visit_VARCHAR(type_)
+
     def visit_text(self, type_): 
         return self.visit_TEXT(type_)
+
+    def visit_unicode_text(self, type_): 
+        return self.visit_TEXT(type_)
     
     def visit_null(self, type_):
         raise NotImplementedError("Can't generate DDL for the null type")
index f96805fe4947f9f57b750d169aecec14aff9ce35..834bace69ae8d6a36cc03dab94a8ae95d66d27c8 100644 (file)
@@ -57,7 +57,7 @@ def Table(*args, **kw):
                        and col.primary_key
                        and getattr(col, '_needs_autoincrement', False))]
         for c in pk_seqs:
-            c.args.append(schema.Sequence(args[0] + '_' + c.name + '_seq', optional=True))
+            c._init_items(schema.Sequence(args[0] + '_' + c.name + '_seq', optional=True))
     return schema.Table(*args, **kw)
 
 
index 39dab81b5ae11bde49d25782a1f36b727e8d69c0..077acd3940c454935c50858eec39c24ba2dcd54f 100644 (file)
@@ -614,7 +614,7 @@ class ComparesTables(object):
                 set(type(reflected_c.type).__mro__).difference(base_mro).intersection(
                 set(type(c.type).__mro__).difference(base_mro)
                 )
-            ) > 0, "Type '%s' doesn't correspond to type '%s'" % (reflected_c.type, c.type)
+            ) > 0, "On column %r, type '%s' doesn't correspond to type '%s'" % (reflected_c.name, reflected_c.type, c.type)
 
             if isinstance(c.type, sqltypes.String):
                 eq_(c.type.length, reflected_c.type.length)
@@ -627,7 +627,7 @@ class ComparesTables(object):
                 # ignore reflection of bogus db-generated DefaultClause()
                 pass
             elif not c.primary_key or not against('postgres'):
-                print repr(c)
+                #print repr(c)
                 assert reflected_c.default is None, reflected_c.default
 
         assert len(table.primary_key) == len(reflected_table.primary_key)
index 228d8a59de0d3c2f813dad08911cd20585e9101d..5162cc53b5f2731cf14a0a594872ccbf8c371122 100644 (file)
@@ -560,6 +560,8 @@ class Unicode(String):
 
     """
 
+    __visit_name__ = 'unicode'
+    
     def __init__(self, length=None, **kwargs):
         """
         Create a Unicode-converting String type.
@@ -579,6 +581,8 @@ class Unicode(String):
 class UnicodeText(Text):
     """A synonym for Text(convert_unicode=True, assert_unicode='warn')."""
 
+    __visit_name__ = 'unicode_text'
+
     def __init__(self, length=None, **kwargs):
         """
         Create a Unicode-converting Text type.
@@ -965,6 +969,11 @@ class CLOB(Text):
 
     __visit_name__ = 'CLOB'
 
+class NCLOB(Text):
+    """The SQL NCLOB type."""
+
+    __visit_name__ = 'NCLOB'
+
 
 class VARCHAR(String):
     """The SQL VARCHAR type."""
index 70e42ced0a0650b80daeeb898a22a56cc67cd4a7..e12cffe606bcec45a6b5ecf8735478aafd853cf4 100644 (file)
@@ -8,6 +8,7 @@ from sqlalchemy.databases import oracle
 from sqlalchemy.test import *
 from sqlalchemy.test.testing import eq_
 from sqlalchemy.test.engines import testing_engine
+from sqlalchemy.dialect.oracle import cx_oracle
 import os
 
 
@@ -292,6 +293,30 @@ class TypesTest(TestBase, AssertsCompiledSQL):
         b = bindparam("foo", u"hello world!")
         assert b.type.dialect_impl(dialect).get_dbapi_type(dbapi) == 'STRING'
 
+    def test_timestamp_adapt(self):
+        dialect = oracle.OracleDialect()
+        t1 = types.DateTime
+        t3 = types.TIMESTAMP
+        
+        
+        assert isinstance(dialect.type_descriptor(t1), cx_oracle.OracleTimestamp)
+        assert isinstance(dialect.type_descriptor(t3), cx_oracle.OracleTimestamp)
+
+    def test_string_adapt(self):
+        oracle_dialect = oracle.OracleDialect()
+
+        for dialect, start, test in [
+            (oracle_dialect, String(), String),
+            (oracle_dialect, VARCHAR(), VARCHAR),
+            (oracle_dialect, String(50), String),
+            (oracle_dialect, Unicode(), Unicode),
+            (oracle_dialect, UnicodeText(), cx_oracle.OracleUnicodeText),
+            (oracle_dialect, NCHAR(), NCHAR),
+            (oracle_dialect, oracle.OracleRaw(50), oracle.OracleRaw),
+        ]:
+            assert isinstance(start.dialect_impl(dialect), test), "wanted %r got %r" % (test, start.dialect_impl(dialect))
+
+
     def test_reflect_raw(self):
         types_table = Table(
         'all_types', MetaData(testing.db),
index 22aa9577c92586f3bbef04604eeadc1768cfc160..d35f74bb025f4667f795d75139fe29c9f10de15f 100644 (file)
@@ -15,7 +15,7 @@ class ExecuteTest(TestBase):
         global users, metadata
         metadata = MetaData(testing.db)
         users = Table('users', metadata,
-            Column('user_id', INT, primary_key = True),
+            Column('user_id', INT, primary_key = True, test_needs_autoincrement=True),
             Column('user_name', VARCHAR(20)),
         )
         metadata.create_all()
index 0e2a9ae1aca41a8fdb009519ed536ee50a1d0add..4d462ce3ecb8b63d27bec21dd3293993c49c5614 100644 (file)
@@ -1,5 +1,5 @@
 import threading, time
-from sqlalchemy import pool, interfaces, create_engine
+from sqlalchemy import pool, interfaces, create_engine, select
 import sqlalchemy as tsa
 from sqlalchemy.test import TestBase, testing
 from sqlalchemy.test.util import gc_collect, lazy_gc
@@ -391,7 +391,7 @@ class PoolTest(PoolTestBase):
         listener.connect = listener
         engine = create_engine(testing.db.url)
         engine.pool.add_listener(listener)
-        engine.execute('select 1')
+        engine.execute(select([1]))
         assert called, "Listener not called on connect"
 
 
index 33f7190121d9007e5f1af8ebdc02012ca8f408d1..97ec107546ea9f92b586627335710e9fd2a970bb 100644 (file)
@@ -27,7 +27,7 @@ class ReflectionTest(TestBase, ComparesTables):
             Column('test1', sa.CHAR(5), nullable=False),
             Column('test2', sa.Float(5), nullable=False),
             Column('test3', sa.Text),
-            Column('test4', sa.Numeric, nullable = False),
+            Column('test4', sa.Numeric(10, 2), nullable = False),
             Column('test5', sa.Date),
             Column('parent_user_id', sa.Integer,
                    sa.ForeignKey('engine_users.user_id')),
@@ -36,7 +36,7 @@ class ReflectionTest(TestBase, ComparesTables):
             Column('test8', sa.Binary),
             Column('test_passivedefault2', sa.Integer, server_default='5'),
             Column('test9', sa.Binary(100)),
-            Column('test_numeric', sa.Numeric()),
+            Column('test10', sa.Numeric(10, 2)),
             test_needs_fk=True,
         )
 
@@ -571,7 +571,7 @@ class ReflectionTest(TestBase, ComparesTables):
             m9.reflect()
             self.assert_(not m9.tables)
 
-    @testing.fails_on_everything_except('postgres', 'mysql', 'sqlite')
+    @testing.fails_on_everything_except('postgres', 'mysql', 'sqlite', 'oracle')
     def test_index_reflection(self):
         m1 = MetaData(testing.db)
         t1 = Table('party', m1,
@@ -828,7 +828,7 @@ def createTables(meta, schema=None):
         Column('test1', sa.CHAR(5), nullable=False),
         Column('test2', sa.Float(5), nullable=False),
         Column('test3', sa.Text),
-        Column('test4', sa.Numeric, nullable = False),
+        Column('test4', sa.Numeric(10, 2), nullable = False),
         Column('test5', sa.DateTime),
         Column('test5-1', sa.TIMESTAMP),
         parent_user_id,
@@ -837,7 +837,7 @@ def createTables(meta, schema=None):
         Column('test8', sa.Binary),
         Column('test_passivedefault2', sa.Integer, server_default='5'),
         Column('test9', sa.Binary(100)),
-        Column('test_numeric', sa.Numeric()),
+        Column('test10', sa.Numeric(10, 2)),
         schema=schema,
         test_needs_fk=True,
     )
@@ -939,8 +939,6 @@ class ComponentReflectionTest(TestBase):
             insp = Inspector(meta.bind)
             for (table_name, table) in zip(table_names, (users, addresses)):
                 schema_name = schema
-                if schema and testing.against('oracle'):
-                    schema_name = schema.upper()
                 cols = insp.get_columns(table_name, schema=schema_name)
                 self.assert_(len(cols) > 0, len(cols))
                 # should be in order
@@ -1056,16 +1054,10 @@ class ComponentReflectionTest(TestBase):
             insp = Inspector(meta.bind)
             indexes = insp.get_indexes('users', schema=schema)
             indexes.sort()
-            if testing.against('oracle'):
-                expected_indexes = [
-                    {'unique': False,
-                     'column_names': ['TEST1', 'TEST2'],
-                     'name': 'USERS_T_IDX'}]
-            else:
-                expected_indexes = [
-                    {'unique': False,
-                     'column_names': ['test1', 'test2'],
-                     'name': 'users_t_idx'}]
+            expected_indexes = [
+                {'unique': False,
+                 'column_names': ['test1', 'test2'],
+                 'name': 'users_t_idx'}]
             index_names = [d['name'] for d in indexes]
             for e_index in expected_indexes:
                 assert e_index['name'] in index_names
index 368f3dd65b9ae79b9e4a783bd879e4dd7774da7b..bcac7c01d2acfadd077277262b3d12d46ecf55d7 100644 (file)
@@ -93,10 +93,16 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
         ], repr(result)
 
     def test_table_alias_names(self):
-        self.assert_compile(
-            table2.alias().select(),
-            "SELECT table_with_exactly_29_c_1.this_is_the_primarykey_column, table_with_exactly_29_c_1.this_is_the_data_column FROM table_with_exactly_29_characs AS table_with_exactly_29_c_1"
-        )
+        if testing.against('oracle'):
+            self.assert_compile(
+                table2.alias().select(),
+                "SELECT table_with_exactly_29_c_1.this_is_the_primarykey_column, table_with_exactly_29_c_1.this_is_the_data_column FROM table_with_exactly_29_characs table_with_exactly_29_c_1"
+            )
+        else:
+            self.assert_compile(
+                table2.alias().select(),
+                "SELECT table_with_exactly_29_c_1.this_is_the_primarykey_column, table_with_exactly_29_c_1.this_is_the_data_column FROM table_with_exactly_29_characs AS table_with_exactly_29_c_1"
+            )
 
         ta = table2.alias()
         dialect = default.DefaultDialect()
index 084fbede476e4bc1c7b4def09ee0d84dca1c5ab8..19935b0bf5938a027b8cf1ccfa045f9d5d9bd2dc 100644 (file)
@@ -14,6 +14,8 @@ from sqlalchemy.test import *
 
 class AdaptTest(TestBase):
     def testmsnvarchar(self):
+        # TODO: migrate these tests to dialect modules
+
         dialect = mssql.dialect()
         # run the test twice to ensure the caching step works too
         for x in range(0, 1):
@@ -22,16 +24,9 @@ class AdaptTest(TestBase):
             assert isinstance(dialect_type, mssql.MSNVarchar)
             eq_(dialect.type_compiler.process(dialect_type), 'NVARCHAR(10)')
 
-    def testoracletimestamp(self):
-        dialect = oracle.OracleDialect()
-        t1 = oracle.OracleTimestamp
-        t2 = oracle.OracleTimestamp()
-        t3 = types.TIMESTAMP
-        assert isinstance(dialect.type_descriptor(t1), oracle.OracleTimestamp)
-        assert isinstance(dialect.type_descriptor(t2), oracle.OracleTimestamp)
-        assert isinstance(dialect.type_descriptor(t3), oracle.OracleTimestamp)
-
     def testmysqlbinary(self):
+        # TODO: migrate these tests to dialect modules
+
         dialect = mysql.MySQLDialect()
         t1 = mysql.MSVarBinary
         t2 = mysql.MSVarBinary()
@@ -40,20 +35,14 @@ class AdaptTest(TestBase):
 
     def teststringadapt(self):
         """test that String with no size becomes TEXT, *all* others stay as varchar/String"""
-
-        oracle_dialect = oracle.OracleDialect()
+        
+        # TODO: migrate these tests to dialect modules
+        
         mysql_dialect = mysql.MySQLDialect()
         postgres_dialect = postgres.PGDialect()
         firebird_dialect = firebird.FBDialect()
 
         for dialect, start, test in [
-            (oracle_dialect, String(), String),
-            (oracle_dialect, VARCHAR(), VARCHAR),
-            (oracle_dialect, String(50), String),
-            (oracle_dialect, Unicode(), Unicode),
-            (oracle_dialect, UnicodeText(), oracle.OracleText),
-            (oracle_dialect, NCHAR(), NCHAR),
-            (oracle_dialect, oracle.OracleRaw(50), oracle.OracleRaw),
             (mysql_dialect, String(), mysql.MSString),
             (mysql_dialect, VARCHAR(), mysql.MSString),
             (mysql_dialect, String(50), mysql.MSString),