summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-29 22:27:45 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-29 22:27:45 +0000
commit83d05aa5aff0b27027fb10986390d898a3153eb2 (patch)
tree2f4b30d080442e0ec54d684262614717141a38fa /lib/sqlalchemy/databases
parentcdde69e7bdef6d9a8a074d1051e099e217d33acf (diff)
downloadsqlalchemy-83d05aa5aff0b27027fb10986390d898a3153eb2.tar.gz
engine.url cleanups [ticket:742]
- translate_connect_args can now take kw args or the classic list - in-tree dialects updated to supply their overrides as keywords - tweaked url parsing in the spirit of the #742 patch, more or less
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r--lib/sqlalchemy/databases/access.py12
-rw-r--r--lib/sqlalchemy/databases/firebird.py2
-rw-r--r--lib/sqlalchemy/databases/mssql.py2
-rw-r--r--lib/sqlalchemy/databases/mysql.py3
-rw-r--r--lib/sqlalchemy/databases/postgres.py2
5 files changed, 10 insertions, 11 deletions
diff --git a/lib/sqlalchemy/databases/access.py b/lib/sqlalchemy/databases/access.py
index 2d36049ed..7552b897d 100644
--- a/lib/sqlalchemy/databases/access.py
+++ b/lib/sqlalchemy/databases/access.py
@@ -202,14 +202,14 @@ class AccessDialect(default.DefaultDialect):
dbapi = classmethod(dbapi)
def create_connect_args(self, url):
- opts = url.translate_connect_args(['host', 'database', 'username', 'password', 'port'])
+ opts = url.translate_connect_args()
connectors = ["Driver={Microsoft Access Driver (*.mdb)}"]
connectors.append("Dbq=%s" % opts["database"])
- user = opts.get("user")
+ user = opts.get("username", None)
if user:
connectors.append("UID=%s" % user)
connectors.append("PWD=%s" % opts.get("password", ""))
- return [[";".join (connectors)], {}]
+ return [[";".join(connectors)], {}]
def create_execution_context(self, *args, **kwargs):
return AccessExecutionContext(self, *args, **kwargs)
@@ -273,8 +273,7 @@ class AccessDialect(default.DefaultDialect):
# A fresh DAO connection is opened for each reflection
# This is necessary, so we get the latest updates
- opts = connection.engine.url.translate_connect_args(['host', 'database', 'username', 'password', 'port'])
- dtbs = daoEngine.OpenDatabase(opts['database'])
+ dtbs = daoEngine.OpenDatabase(connection.engine.url.database)
try:
for tbl in dtbs.TableDefs:
@@ -340,8 +339,7 @@ class AccessDialect(default.DefaultDialect):
def table_names(self, connection, schema):
# A fresh DAO connection is opened for each reflection
# This is necessary, so we get the latest updates
- opts = connection.engine.url.translate_connect_args(['host', 'database', 'username', 'password', 'port'])
- dtbs = daoEngine.OpenDatabase(opts['database'])
+ dtbs = daoEngine.OpenDatabase(connection.engine.url.database)
names = [t.Name for t in dtbs.TableDefs if t.Name[:4] != "MSys" and t.Name[:4] <> "~TMP"]
dtbs.Close()
diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py
index 2a9bbb5bd..a4262d9ca 100644
--- a/lib/sqlalchemy/databases/firebird.py
+++ b/lib/sqlalchemy/databases/firebird.py
@@ -116,7 +116,7 @@ class FBDialect(default.DefaultDialect):
dbapi = classmethod(dbapi)
def create_connect_args(self, url):
- opts = url.translate_connect_args(['host', 'database', 'user', 'password', 'port'])
+ opts = url.translate_connect_args(username='user')
if opts.get('port'):
opts['host'] = "%s/%s" % (opts['host'], opts['port'])
del opts['port']
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 03b276d4a..8a23ce9a3 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -447,7 +447,7 @@ class MSSQLDialect(default.DefaultDialect):
dbapi = classmethod(dbapi)
def create_connect_args(self, url):
- opts = url.translate_connect_args(['host', 'database', 'user', 'password', 'port'])
+ opts = url.translate_connect_args(username='user')
opts.update(url.query)
if 'auto_identity_insert' in opts:
self.auto_identity_insert = bool(int(opts.pop('auto_identity_insert')))
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index af01cf84e..6d5c54578 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -1353,7 +1353,8 @@ class MySQLDialect(default.DefaultDialect):
dbapi = classmethod(dbapi)
def create_connect_args(self, url):
- opts = url.translate_connect_args(['host', 'db', 'user', 'passwd', 'port'])
+ opts = url.translate_connect_args(database='db', username='user',
+ password='passwd')
opts.update(url.query)
util.coerce_kw_type(opts, 'compress', bool)
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index e2876f1f8..eecdcebbd 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -240,7 +240,7 @@ class PGDialect(default.DefaultDialect):
dbapi = classmethod(dbapi)
def create_connect_args(self, url):
- opts = url.translate_connect_args(['host', 'database', 'user', 'password', 'port'])
+ opts = url.translate_connect_args(username='user')
if 'port' in opts:
opts['port'] = int(opts['port'])
opts.update(url.query)