summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/databases/access.py11
-rw-r--r--lib/sqlalchemy/databases/firebird.py13
-rw-r--r--lib/sqlalchemy/databases/informix.py9
-rw-r--r--lib/sqlalchemy/databases/maxdb.py10
-rw-r--r--lib/sqlalchemy/databases/mssql.py12
-rw-r--r--lib/sqlalchemy/databases/mysql.py12
-rw-r--r--lib/sqlalchemy/databases/oracle.py10
-rw-r--r--lib/sqlalchemy/databases/postgres.py11
-rw-r--r--lib/sqlalchemy/databases/sqlite.py8
-rw-r--r--lib/sqlalchemy/databases/sybase.py11
-rw-r--r--lib/sqlalchemy/engine/base.py9
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
12 files changed, 18 insertions, 100 deletions
diff --git a/lib/sqlalchemy/databases/access.py b/lib/sqlalchemy/databases/access.py
index 55b48e4bc..425c1eb69 100644
--- a/lib/sqlalchemy/databases/access.py
+++ b/lib/sqlalchemy/databases/access.py
@@ -117,15 +117,6 @@ class AcTimeStamp(types.TIMESTAMP):
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:
@@ -176,7 +167,7 @@ class AccessDialect(default.DefaultDialect):
types.CHAR: AcChar,
types.TIMESTAMP: AcTimeStamp,
}
-
+ name = 'access'
supports_sane_rowcount = False
supports_sane_multi_rowcount = False
diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py
index f8b4689d8..c7b64a6b2 100644
--- a/lib/sqlalchemy/databases/firebird.py
+++ b/lib/sqlalchemy/databases/firebird.py
@@ -262,17 +262,6 @@ ischema_names = {
}
-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)
@@ -315,7 +304,7 @@ class FBExecutionContext(default.DefaultExecutionContext):
class FBDialect(default.DefaultDialect):
"""Firebird dialect"""
-
+ name = 'firebird'
supports_sane_rowcount = False
supports_sane_multi_rowcount = False
max_identifier_length = 31
diff --git a/lib/sqlalchemy/databases/informix.py b/lib/sqlalchemy/databases/informix.py
index 42c46db7c..130b08c41 100644
--- a/lib/sqlalchemy/databases/informix.py
+++ b/lib/sqlalchemy/databases/informix.py
@@ -178,14 +178,6 @@ ischema_names = {
-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
@@ -206,6 +198,7 @@ class InfoExecutionContext(default.DefaultExecutionContext):
return informix_cursor( self.connection.connection )
class InfoDialect(default.DefaultDialect):
+ name = 'informix'
default_paramstyle = 'qmark'
# for informix 7.31
max_identifier_length = 18
diff --git a/lib/sqlalchemy/databases/maxdb.py b/lib/sqlalchemy/databases/maxdb.py
index 262a8f0fc..b3f232a17 100644
--- a/lib/sqlalchemy/databases/maxdb.py
+++ b/lib/sqlalchemy/databases/maxdb.py
@@ -466,6 +466,7 @@ class MaxDBResultProxy(engine_base.ResultProxy):
class MaxDBDialect(default.DefaultDialect):
+ name = 'maxdb'
supports_alter = True
supports_unicode_statements = True
max_identifier_length = 32
@@ -1092,15 +1093,6 @@ def _autoserial_column(table):
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
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 4f6db935f..112c8ead4 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -278,16 +278,6 @@ class MSVariant(sqltypes.TypeEngine):
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
@@ -369,6 +359,7 @@ class MSSQLExecutionContext_pyodbc (MSSQLExecutionContext):
super(MSSQLExecutionContext_pyodbc, self).post_exec()
class MSSQLDialect(default.DefaultDialect):
+ name = 'mssql'
colspecs = {
sqltypes.Unicode : MSNVarchar,
sqltypes.Integer : MSInteger,
@@ -983,6 +974,7 @@ class MSSQLCompiler(compiler.DefaultCompiler):
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',
}
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index ed01b77d7..e2ee5330c 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -1380,16 +1380,6 @@ ischema_names = {
'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):
@@ -1413,7 +1403,7 @@ class MySQLExecutionContext(default.DefaultExecutionContext):
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...
diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py
index 00c3c1e01..815024a00 100644
--- a/lib/sqlalchemy/databases/oracle.py
+++ b/lib/sqlalchemy/databases/oracle.py
@@ -188,15 +188,6 @@ ischema_names = {
'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()
@@ -240,6 +231,7 @@ class OracleExecutionContext(default.DefaultExecutionContext):
return base.ResultProxy(self)
class OracleDialect(default.DefaultDialect):
+ name = 'oracle'
supports_alter = True
supports_unicode_statements = False
max_identifier_length = 30
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 944d8c3aa..6e77f02d8 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -225,16 +225,6 @@ ischema_names = {
'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)
@@ -316,6 +306,7 @@ class PGExecutionContext(default.DefaultExecutionContext):
super(PGExecutionContext, self).post_exec()
class PGDialect(default.DefaultDialect):
+ name = 'postgres'
supports_alter = True
supports_unicode_statements = False
max_identifier_length = 63
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index bbfb99d65..620713fe1 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -196,13 +196,6 @@ ischema_names = {
'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:
@@ -213,6 +206,7 @@ class SQLiteExecutionContext(default.DefaultExecutionContext):
return SELECT_REGEXP.match(statement)
class SQLiteDialect(default.DefaultDialect):
+ name = 'sqlite'
supports_alter = False
supports_unicode_statements = True
default_paramstyle = 'qmark'
diff --git a/lib/sqlalchemy/databases/sybase.py b/lib/sqlalchemy/databases/sybase.py
index 45a98bec5..fd5b875a2 100644
--- a/lib/sqlalchemy/databases/sybase.py
+++ b/lib/sqlalchemy/databases/sybase.py
@@ -350,16 +350,6 @@ class SybaseUniqueIdentifier(sqltypes.TypeEngine):
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
@@ -460,6 +450,7 @@ class SybaseSQLDialect(default.DefaultDialect):
'java serialization' : SybaseTypeError,
}
+ name = 'sybase'
# Sybase backend peculiarities
supports_unicode_statements = False
supports_sane_rowcount = False
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 2ca2ac5f7..412c3a2f6 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -28,7 +28,10 @@ class Dialect(object):
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.
@@ -1124,8 +1127,8 @@ class Engine(Connectable):
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()
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 3b82fbdd0..b6da29736 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -788,7 +788,7 @@ class SchemaGenerator(DDLBase):
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"