I just found a similar error here from FEB 2011.

http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg22861.html

And similar to what happened in that thread, when I deleted the date column,
the error disappeared!!

Perhaps it has something to do with the formatting of the dates in sqlite,
because when I enter the data through the web interface forms (I use
formalchemy) it works fine. I wonder why it would mess up querying though! I
will have to look into this.

Cheers,
Ahmed


On Tue, May 31, 2011 at 12:41 PM, Ahmed <ahmedba...@gmail.com> wrote:

> Hello,
>
> I have an issue, not sure if it is a bug or I am just screwing some
> things up.
> Anyway: I am using pyramid with a sqlite db in develop mode (still not
> in production).
>
> I then imported some data from csv into a table which includes a
> primary key. (that is: primary key id values included in the csv and
> was imported in the primary key auto increment column)
>
> When querying the data, sqalchemy throws an error.
> AttributeError: 'NoneType' object has no attribute 'groups'
>
> It seems the 'row' variable is None.
>
> The catch is: this error does not appear when trying to *only* query
> records created via sqlalchemy via the web interface before or after
> said import. However, when any query result includes *any* of the
> records that was originally added via the import and not via
> sqlalchemy ... this error is thrown. It is as if sqlalchemy cannot
> read/fetch the entered primary key values 'manually' set via the
> import.
>
> I am not sure if I am doing the right approach for the import, but I
> would appreciate any advice, and if you think it is a bug, then I will
> then submit it in the correct place for that.
>
> Cheers,
> Ahmed
>
> Here is the sqlalchemy error:
> File '/home/ahmed/dev/pyrenv/gess/gess/models/__init__.py', line 97 in
> query_byID
>  return DBSession.query(model).filter_by(id=id).one()
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/query.py', line 1646 in one
>  ret = list(self)
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/query.py', line 1798 in
> instances
>  rows = [process[0](row, None) for row in fetch]
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/mapper.py', line 2281 in
> _instance
>  populate_state(state, dict_, row, isnew, only_load_props)
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/mapper.py', line 2159 in
> populate_state
>  populator(state, dict_, row)
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/strategies.py', line 130 in
> new_execute
>  dict_[key] = row[col]
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/base.py', line 2023 in
> __getitem__
>  return processor(self._row[index])
> File '/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/processors.py', line 27 in
> process
>  return type_(*map(int, rmatch(value).groups(0)))
> AttributeError: 'NoneType' object has no attribute 'groups'

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