>
> Produce the simplest program you can that causes the error, then post 
> both the code and full exception here.
>
> Paul

Sorry about the wrong subject in the last post. Google groups are quite 
annoying.

This is the minimal program that causes the error:

db = sa.create_engine('mysql://myuser:[EMAIL PROTECTED]/mydatabase')
metadata = sa.BoundMetaData(db)

def user_mapper():
    '''Create the object/relational link for users'''
    users_table = sa.Table('Users', metadata, autoload=True)
    sa.orm.clear_mappers()
    sa.mapper(User, users_table)
    
    session = sa.create_session(bind_to=db)
    query = session.query(User)

    return session, query

def authenticate(req, username, password):
    '''Grant access if password matches the one stored in the db'''
    dbsession, query = user_mapper()
    try:
        user = query.get_by(Uid=username)
    except sa.exceptions.SQLError, details:
        return "Database error: %s" % details
    else:
        if user == None:
            return print_error(req, "That user does not exist!")


The error I get is:

Database error: (InterfaceError) (0, '') u'SELECT `Users`.`Uid` AS `Users_Uid`, 
`Users`.`Country` AS `Users_Country`, `Users`.`LName` AS `Users_LName`, 
`Users`.`Credits` AS `Users_Credits`, `Users`.`Pwd` AS `Users_Pwd`, 
`Users`.`PhoneNumber` AS `Users_PhoneNumber`, `Users`.`FName` AS `Users_FName`, 
`Users`.`MoneyBalance` AS `Users_MoneyBalance`, `Users`.`Email` AS 
`Users_Email` \nFROM `Users` \nWHERE `Users`.`Uid` = %s ORDER BY `Users`.`Uid` 
\n LIMIT 1' ['testuser']


Notice this sometimes works and sometime it doesn't.

This is under mod_python with SQLAlchemy 0.3.7 in case it matters.

Thanks!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to