ffernand wrote: > > I've been using sqlalchemy for the past couple months in development > without incident until I started applying unique indexes. I've had > issues with duplicate rows as expected, but now i'm seeing a different > error that I hadn't seen before... > > NoSuchColumnError: "Could not locate column in row for column > 'rosetta_keys.id'" > > It's hard to reproduce because it only shows up (some of the time) > when the process forks and only when indexes are applied to tables in > question. > > It's not always the same table, but I can say that it occurs when two > processes are touching the same table. I'm using sqlsoup to make this > all happen.
when you fork a child, any engines you have created must be replaced with new engines. TCP connections don't really travel across forks very well so you'll want to ensure create_engine() is called at the beginning of each child, and applied to all places where an engine is needed (i.e. sessions, metadata objects). > > I'm using sqlalchemy 0.56 > Ubuntu 9.10 64-bit, python 2.6 > mysql-python 1.2.3c1 > > Here's a stack trace... > > Traceback (most recent call last): > File "/home/ffernand/src/thescore-feed/feeds/fss/worker.py", line > 46, in process_queue > (errorlog, created, updated), processed = method(xmldoc), True > File "/home/ffernand/src/thescore-feed/feeds/__init__.py", line 129, > in handle > results = fn(*args, **kwargs) > File "/home/ffernand/src/thescore-feed/feeds/__init__.py", line 182, > in handle > results = fn(*args, **kwargs) > File "/home/ffernand/src/thescore-feed/feeds/__init__.py", line 152, > in handle > results = fn(*args, **kwargs) > File "/home/ffernand/src/thescore-feed/lib/feeds/sport/hockey/ > entities.py", line 114, in handle > results = fn(*args, **kwargs) > File "/home/ffernand/src/thescore-feed/feeds/fss/leagues/nhl/ > playerstats.py", line 26, in NHL_PLAYERSTATS > player_id = get_player_id(global_id, last_name, first_name) > File "/home/ffernand/src/thescore-feed/lib/feeds/sport/hockey/ > entities.py", line 55, in get_player_id > if global_id else None > File "/home/ffernand/src/thescore-feed/lib/feeds/rosetta.py", line > 24, in get_rosetta_id > obj, created = orm.db.rosetta_keys.filter_by(**filter).first(), > False > File "./lib/vendor/sqlalchemy/orm/query.py", line 1300, in first > ret = list(self[0:1]) > File "./lib/vendor/sqlalchemy/orm/query.py", line 1221, in > __getitem__ > return list(res) > File "./lib/vendor/sqlalchemy/orm/query.py", line 1420, in instances > process[0](context, row, rows) > File "./lib/vendor/sqlalchemy/orm/query.py", line 2029, in main > _instance(row, result) > File "./lib/vendor/sqlalchemy/orm/mapper.py", line 1631, in > _instance > identitykey = identity_key(row) > File "./lib/vendor/sqlalchemy/orm/mapper.py", line 1572, in > identity_key > return (identity_class, tuple(row[column] for column in pk_cols)) > File "./lib/vendor/sqlalchemy/orm/mapper.py", line 1572, in > <genexpr> > return (identity_class, tuple(row[column] for column in pk_cols)) > File "./lib/vendor/sqlalchemy/engine/base.py", line 1348, in > __getitem__ > return self.__parent._get_col(self.__row, key) > File "./lib/vendor/sqlalchemy/engine/base.py", line 1609, in > _get_col > type_, processor, index = self._props[key] > File "./lib/vendor/sqlalchemy/util.py", line 68, in __missing__ > self[key] = val = self.creator(key) > File "./lib/vendor/sqlalchemy/engine/base.py", line 1507, in > fallback > raise exc.NoSuchColumnError("Could not locate column in row for > column '%s'" % (str(key))) > NoSuchColumnError: "Could not locate column in row for column > 'rosetta_keys.id'" > > Any suggestions would be greatly appreciated... > > thanks, > filipe > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---