Greetings. I'm working on my first Pylons project and am just trying
to get familiar with things in a test environment. I'm having no
success linking to the MySQL database. I have stalled out with a
problem that I've seen others report, but didn't see any responses
that looked relevant (I could be wrong - the world has changed in the
decade plus since I last did much development).
I saw references to mapper but I don't understand what mapper has to
do with this. My noob understanding of mapper may not be correct.
*** Environment:
Debian Etch
Python 2.4.4
Pylons 0.9.6.2-1
SQLalchemy 0.3.1-2
*** Here is the last bit of the error:
File '/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py', line
1413 in class_mapper
raise exceptions.InvalidRequestError("Class '%s' entity name '%s'
has no mapper associated with it" % (class_.__name__, entity_name))
InvalidRequestError: Class 'Users' entity name 'None' has no mapper
associated with it
*** Here are the code examples:
*** FROM __init__.py:
import sqlalchemy as sa
import sqlalchemy.orm as orm
class Users(object):
def __repr__(self):
return "%s (%r, %r, %r, %r, %r)" % (
self.__class__.__name__,
self.users_username,
self.users_password,
self.users_email,
self.users_date_added,
self.users_jurisdictions,
)
def init_model(app_conf):
global metadata, users
if not globals().get('metadata'):
dsn = app_conf['sqlalchemy.dburi']
metadata = sa.BoundMetaData(dsn)
users = sa.Table('libertyfile', metadata,
autoload=True)
orm.mapper(Users, users)
def create_all(app_conf):
init_model(app_conf)
metadata.create_all()
*** excerpts FROM hello.py (relevant portions only)
from helloworld.model import Users
### = error line
if request.params['submit'] == 'Submit':
query = dbsession.query(Users) ###
user = query.get_by(users_username=c.user_username)
if user is None:
Thank you for any insight or guidance that can point me in the right
direction.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---