Hi there, Is there a standard way to pass extra arguments to the underlying DB-API's connect(..) function via the URL?
For example, MySQLdb's connect takes a parameter called init_command. I need this to set the MySQL driver to return UTF-8 encoded strings correctly. The SA way of defining a custom creator function and a user-provided Pool class does not fit very well to my TurboGears project (to say the least). The dialect's constructor receives the url query-part as a dict. I modified the MySQL dialect a little so that it picks 'init_command' out of the list and stores them in a member variable. I then use these in "create_connect_args". The start of MySQLDialect then looks like this: class MySQLDialect(ansisql.ANSIDialect): def __init__(self, module = None, **kwargs): if module is None: self.module = mysql else: self.module = module dbapiargs = ('init_command',) # add more choices here self.extraargs = {} for arg in dbapiargs: if arg in kwargs: self.extraargs[arg] = kwargs.pop(arg) ansisql.ANSIDialect.__init__(self, **kwargs) def create_connect_args(self, url): opts = self.extraargs.copy() opts.update(url.translate_connect_args(['host', 'db', 'user', 'passwd', 'port'])) return [[], opts] Then I can use an url like "mysql://user:[EMAIL PROTECTED]/database?init_command=set%20character%20set%20utf8". I know this is not the proper way of doing this, but it gets my idea across. Is there any way something like this would be implemented in SA? Arnar ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users