Here is the small program and it run.
from sqlalchemy import *
from _mysql_exceptions import OperationalError
class db(object):
def __init__(self):
connect_string = "mysql://mike:[EMAIL PROTECTED]/abc"
engine = create_engine(connect_string,
strategy='threadlocal')
metadata = BoundMetaData(engine)
companys = Table('company', metadata, autoload=True)
a = db()
Traceback (most recent call last):
File "test.py", line 17, in ?
a = db()
File "test.py", line 15, in __init__
companys = Table('company', metadata, autoload=True)
File "build/bdist.linux-x86_64/egg/sqlalchemy/schema.py", line 96, in
__call__ File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py",
line 480, in reflecttable
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/threadlocal.py",
line 111, in contextual_connect
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/threadlocal.py",
line 17, in get_connection
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/threadlocal.py",
line 53, in __init__
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line
177, in __init__
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/threadlocal.py",
line 97, in raw_connection
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line
34, in get_connection
File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 90, in
connect
File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 135, in
__init__
File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 110, in get
File "build/bdist.linux-x86_64/egg/sqlalchemy/pool.py", line 235, in
do_get
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line
27, in <lambda>
File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 75,
in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
164, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user
'mike'@'mike' (using password: YES)")
Michael Bayer wrote:
> youll have to show me how youre getting that result. all the
> exceptions raised by the database should be wrapped in a
> SQLAlchemyError.
>
> On Jul 13, 2006, at 3:30 PM, Mike Bernson wrote:
>
>> I am trying to write application that does not care which database
>> it is
>> connecting to. It uses the connect string to choose the database.
>>
>> Thing look good until I get an error from mysql which is a raise on
>> mysql classes. Should the raises come from an sqlalchemy class so that
>> I get the same type of exceptions from all database support by
>> sqlalchemy.
>>
>> At this time I am using table object to do select, insert and updates.
>> With things working this way I have to create different try/except for
>> the each database that I support.
>>
>> Is this the way things are meant to work ?
>> Am I missing something that would cause sqlalchemy to raise the
>> exception ?
>>
>>
>>
>> ----------------------------------------------------------------------
>> ---
>> Using Tomcat but need to do more? Need to support web services,
>> security?
>> Get stuff done quickly with pre-integrated technology to make your
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Sqlalchemy-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users