Commits

Mike Bayer committed 6ee8fb4

- re-fixed the fix to the prefixes fix
- removed ancient descriptor() functions from dialects; replaced with Dialect.name
- removed similarly ancient sys.modules silliness in Engine.name

  • Participants
  • Parent commits e5b698b

Comments (0)

Files changed (12)

File lib/sqlalchemy/databases/access.py

     def get_col_spec(self):
         return "TIMESTAMP"
 
-def descriptor():
-    return {'name':'access',
-    'description':'Microsoft Access',
-    'arguments':[
-        ('user',"Database user name",None),
-        ('password',"Database password",None),
-        ('db',"Path to database file",None),
-    ]}
-
 class AccessExecutionContext(default.DefaultExecutionContext):
     def _has_implicit_sequence(self, column):
         if column.primary_key and column.autoincrement:
         types.CHAR: AcChar,
         types.TIMESTAMP: AcTimeStamp,
     }
-
+    name = 'access'
     supports_sane_rowcount = False
     supports_sane_multi_rowcount = False
 

File lib/sqlalchemy/databases/firebird.py

       }
 
 
-def descriptor():
-    return {'name':'firebird',
-    'description':'Firebird',
-    'arguments':[
-        ('host', 'Host Server Name', None),
-        ('database', 'Database Name', None),
-        ('user', 'Username', None),
-        ('password', 'Password', None)
-    ]}
-
-
 SELECT_RE = re.compile(
     r'\s*(?:SELECT|(UPDATE|INSERT|DELETE))',
     re.I | re.UNICODE)
 
 class FBDialect(default.DefaultDialect):
     """Firebird dialect"""
-
+    name = 'firebird'
     supports_sane_rowcount = False
     supports_sane_multi_rowcount = False
     max_identifier_length = 31

File lib/sqlalchemy/databases/informix.py

     -1  : InfoText,         # CLOB
 }
 
-def descriptor():
-    return {'name':'informix',
-    'description':'Informix',
-    'arguments':[
-        ('dsn', 'Data Source Name', None),
-        ('user', 'Username', None),
-        ('password', 'Password', None)
-    ]}
 
 class InfoExecutionContext(default.DefaultExecutionContext):
     # cursor.sqlerrd
         return informix_cursor( self.connection.connection )
 
 class InfoDialect(default.DefaultDialect):
+    name = 'informix'
     default_paramstyle = 'qmark'
     # for informix 7.31
     max_identifier_length = 18

File lib/sqlalchemy/databases/maxdb.py

 
 
 class MaxDBDialect(default.DefaultDialect):
+    name = 'maxdb'
     supports_alter = True
     supports_unicode_statements = True
     max_identifier_length = 32
 
     return None, None
 
-def descriptor():
-    return {'name': 'maxdb',
-    'description': 'MaxDB',
-    'arguments': [
-        ('user', "Database Username", None),
-        ('password', "Database Password", None),
-        ('database', "Database Name", None),
-        ('host', "Hostname", None)]}
-
 dialect = MaxDBDialect
 dialect.preparer = MaxDBIdentifierPreparer
 dialect.statement_compiler = MaxDBCompiler

File lib/sqlalchemy/databases/mssql.py

     def get_col_spec(self):
         return "SQL_VARIANT"
 
-def descriptor():
-    return {'name':'mssql',
-    'description':'MSSQL',
-    'arguments':[
-        ('user',"Database Username",None),
-        ('password',"Database Password",None),
-        ('db',"Database Name",None),
-        ('host',"Hostname", None),
-    ]}
-
 class MSSQLExecutionContext(default.DefaultExecutionContext):
     def __init__(self, *args, **kwargs):
         self.IINSERT = self.HASIDENT = False
             super(MSSQLExecutionContext_pyodbc, self).post_exec()
 
 class MSSQLDialect(default.DefaultDialect):
+    name = 'mssql'
     colspecs = {
         sqltypes.Unicode : MSNVarchar,
         sqltypes.Integer : MSInteger,
         else:
             return super(MSSQLCompiler, self).label_select_column(select, column, asfrom)
 
+    # TODO: update this to use generic functions
     function_rewrites =  {'current_date': 'getdate',
                           'length':     'len',
                           }

File lib/sqlalchemy/databases/mysql.py

     'year': MSYear,
 }
 
-def descriptor():
-    return {'name':'mysql',
-    'description':'MySQL',
-    'arguments':[
-        ('username',"Database Username",None),
-        ('password',"Database Password",None),
-        ('database',"Database Name",None),
-        ('host',"Hostname", None),
-    ]}
-
 
 class MySQLExecutionContext(default.DefaultExecutionContext):
     def post_exec(self):
 
 class MySQLDialect(default.DefaultDialect):
     """Details of the MySQL dialect.  Not used directly in application code."""
-
+    name = 'mysql'
     supports_alter = True
     supports_unicode_statements = False
     # identifiers are 64, however aliases can be 255...

File lib/sqlalchemy/databases/oracle.py

     'LONG' : OracleText,
 }
 
-def descriptor():
-    return {'name':'oracle',
-    'description':'Oracle',
-    'arguments':[
-        ('dsn', 'Data Source Name', None),
-        ('user', 'Username', None),
-        ('password', 'Password', None)
-    ]}
-
 class OracleExecutionContext(default.DefaultExecutionContext):
     def pre_exec(self):
         super(OracleExecutionContext, self).pre_exec()
         return base.ResultProxy(self)
 
 class OracleDialect(default.DefaultDialect):
+    name = 'oracle'
     supports_alter = True
     supports_unicode_statements = False
     max_identifier_length = 30

File lib/sqlalchemy/databases/postgres.py

     'interval':PGInterval,
 }
 
-def descriptor():
-    return {'name':'postgres',
-    'description':'PostGres',
-    'arguments':[
-        ('username',"Database Username",None),
-        ('password',"Database Password",None),
-        ('database',"Database Name",None),
-        ('host',"Hostname", None),
-    ]}
-
 SERVER_SIDE_CURSOR_RE = re.compile(
     r'\s*SELECT',
     re.I | re.UNICODE)
         super(PGExecutionContext, self).post_exec()
 
 class PGDialect(default.DefaultDialect):
+    name = 'postgres'
     supports_alter = True
     supports_unicode_statements = False
     max_identifier_length = 63

File lib/sqlalchemy/databases/sqlite.py

     'VARCHAR': SLString,
 }
 
-def descriptor():
-    return {'name':'sqlite',
-    'description':'SQLite',
-    'arguments':[
-        ('database', "Database Filename",None)
-    ]}
-
 class SQLiteExecutionContext(default.DefaultExecutionContext):
     def post_exec(self):
         if self.compiled.isinsert and not self.executemany:
         return SELECT_REGEXP.match(statement)
 
 class SQLiteDialect(default.DefaultDialect):
+    name = 'sqlite'
     supports_alter = False
     supports_unicode_statements = True
     default_paramstyle = 'qmark'

File lib/sqlalchemy/databases/sybase.py

     def get_col_spec(self):
         return "UNIQUEIDENTIFIER"
 
-def descriptor():
-    return {'name':'sybase',
-    'description':'SybaseSQL',
-    'arguments':[
-        ('user',"Database Username",None),
-        ('password',"Database Password",None),
-        ('db',"Database Name",None),
-        ('host',"Hostname", None),
-    ]}
-
 class SybaseSQLExecutionContext(default.DefaultExecutionContext):
     pass
 
         'java serialization' : SybaseTypeError,
     }
 
+    name = 'sybase'
     # Sybase backend peculiarities
     supports_unicode_statements = False
     supports_sane_rowcount = False

File lib/sqlalchemy/engine/base.py

     ExecutionContext, Compiled, DefaultGenerator, and TypeEngine.
 
     All Dialects implement the following attributes:
-
+    
+    name
+      identifying name for the dialect (i.e. 'sqlite')
+      
     positional
       True if the paramstyle for this Dialect is positional.
 
 
     def name(self):
         "String name of the [sqlalchemy.engine#Dialect] in use by this ``Engine``."
-
-        return sys.modules[self.dialect.__module__].descriptor()['name']
+        
+        return self.dialect.name
     name = property(name)
 
     echo = log.echo_property()

File lib/sqlalchemy/sql/compiler.py

             if column.default is not None:
                 self.traverse_single(column.default)
 
-        self.append("\nCREATE" + " ".join(table._prefixes) + " TABLE " + self.preparer.format_table(table) + " (")
+        self.append("\n" + " ".join(['CREATE'] + table._prefixes + ['TABLE', self.preparer.format_table(table), "("]))
 
         separator = "\n"