hi there,

i want to create a database in mysql and then use it.
this is what I do:

in the __init__
    def __init__( self, connectionstr ):
        self.connectionstr = connectionstr

    def _checkEngine(self):
        if self._db_engine is None:
            self._db_engine = create_engine(self.connectionstr)
            self._metadata = BoundMetaData(self._db_engine)
            self._connection = self._db_engine.connect()


later I do:
self._checkEngine()
self._connection.execute("use %s" % dbname

so long everything seems to work ok.
however, when I try to execute a statement (like creating a table) like this:

table = Table(tblname, self._metadata, *columns)
table.create()

I get an error claiming that no database is selected.:
    table.create()
  File "../../lib/sqlalchemy/schema.py", line 284, in create
  File "../../lib/sqlalchemy/schema.py", line 862, in create_all
  File "../../lib/sqlalchemy/engine/base.py", line 413, in create
  File "../../lib/sqlalchemy/engine/base.py", line 437, in _run_visitor
  File "../../lib/sqlalchemy/schema.py", line 882, in accept_schema_visitor
  File "../../lib/sqlalchemy/ansisql.py", line 637, in visit_metadata
  File "../../lib/sqlalchemy/schema.py", line 268, in accept_schema_visitor
  File "../../lib/sqlalchemy/ansisql.py", line 668, in visit_table
  File "../../lib/sqlalchemy/engine/base.py", line 763, in execute
  File "../../lib/sqlalchemy/engine/base.py", line 365, in proxy
  File "../../lib/sqlalchemy/engine/base.py", line 329, in _execute_raw
  File "../../lib/sqlalchemy/engine/base.py", line 348, in _execute
SQLError: (OperationalError) (1046, 'No database selected')

how can I avoid this ??

thanks
robert


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---
begin:vcard
fn:robert  rottermann
n:rottermann;robert 
email;internet:[EMAIL PROTECTED]
tel;work:031 333 10 20
tel;fax:031 333 10 23
tel;home:031 333 36 03
x-mozilla-html:FALSE
version:2.1
end:vcard

Reply via email to