Yes, you are right. I checked my column types and there was one
incorrect column.

Thanks!

- Darian V Schramm



On Thu, Aug 13, 2009 at 2:20 PM, Michael Bayer<mike...@zzzcomputing.com> wrote:
>
> sounds like one of your column types is incorrect (and assuming
> convert_unicode=True on engine).  otherwise theres no way to know the
> issue without a stack trace.
>
>
> dvschramm wrote:
>>
>> client_id = 309
>> dbclient = session.query(dbclientclass).filter
>> (dbclientclass.client_id==client_id).one()
>>
>> results in  AttributeError: 'long' object has no attribute 'decode'
>>
>> I tried just session.query(dbclientclass).all() and it results in the
>> same error.
>>
>> my class looks as follows:
>>
>> class client(object):
>>     client_id = None
>>     client_nm = ''
>>     client_nm_dsp = ''
>>     plone_uid = ''
>>
>>     def __init__(self, client_nm=None, client_nm_disp=None,
>> plone_uid=None, start_date='', end_date='', status=''):
>>         """
>>         ...
>>         """
>>         self.client_nm = client_nm
>>         self.client_nm_disp = client_nm_disp
>>         self.plone_uid = plone_uid
>>
>>     def __repr__(self):
>>         """
>>         """
>>         return "<Client('%s', '%s', '%s')>" % (self.client_nm_disp,
>> self.client_nm, self.plone_uid)
>>
>> and my table definition:
>>
>>         client_table = sql.Table('client', metadata,
>>                                 sql.Column('client_id', sql.Integer
>> (6), primary_key=True, autoincrement=True),
>>                                 sql.Column('client_nm', sql.String
>> (64)),
>>                                 sql.Column('client_nm_disp', sql.String
>> (64)),
>>                                 sql.Column('plone_uid', sql.String
>> (32)),
>>                                 sql.Column('start_date',
>> sql.DateTime),
>>                                 sql.Column('end_date', sql.DateTime),
>>                                 sql.Column('status', sql.String(16)),
>>                                 sql.Column('storage', sql.Integer),
>>                                 sql.Column('bandwidth', sql.Integer),
>>                                 sql.Column('primary_contact',
>> sql.String(32)),
>>                                 sql.Column('billing_contact',
>> sql.String(32)),
>>                                 sql.Column('user_accounts',
>> sql.Integer),
>>                                 sql.Column('storage_overage',
>> sql.Float),
>>                                 sql.Column('bandwidth_overage',
>> sql.Float ),
>>                                 sql.Column('package', sql.Integer),
>>                                 )
>>
>> Is it necessary to explicitly create all the fields in the client
>> class? What else would cause this error?
>>
>> 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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to