Re: difference between statements
Martin Jenkins <mj-Vfh7fEhEWOlaa/[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Organization | XQP Ltd |
| Message-ID | <[email protected]> |
Eric S. Johansson wrote: > Martin Jenkins wrote: >> Eric S. Johansson wrote: > Regrouping data > Traceback (most recent call last): > File "413830.py", line 294, in ? > main2() > File "413830.py", line 267, in main2 > print " regroup: '%s' - result '%s'" % (intID, ts.regroup(intID)) > File "413830.py", line 238, in regroup > rs = [r[0] for r in candidates.fetchall()] > AttributeError: 'NoneType' object has no attribute 'fetchall' > esj@camram606:~/projects/tpblue/tpblue$ > > the culprit method is... > > def regroup(self, internal_ID): > """given a single ID, get all names """ > select_cmd = "select external_ID from external_internal where > (internal_ID=?)" > candidates = self.cursor.execute(select_cmd,(internal_ID,)) > > # MJ: this gets rid of the "list of tuples" ugliness > rs = [r[0] for r in candidates.fetchall()] > return rs Hmm. This might be a change between your pysqlite and my sqlite3. I'll dig my ubuntu box out and fire that up. Do you want to take this off list? > Martin, you have been wonderfully helpful and I am so very grateful. Thanks ;) > But at this point, I'm about ready to ditch pysqlite because I have > spent way too much time fighting with this toolkit. I know how you feel, but when I looked at your code I was struck as to how close you were to the solution. It might not seem like that from your POV, but you were. > It is only reinforced my impression that it was a good decision to > avoid working with databases for the past 30 years. Ha. :) My first experience was with the Paradox Engine in 1993 and I also swore to avoid databases for ever. > would be any easier to work with apsw (3.2.7r1-1). I prefer APSW because it's closer to SQLite (it makes no attempt to adhere to Python's DBAPI). I don't think it would make much difference to the bit of your code that I've seen here. If you have the time I'd be inclined to get it working with pysqlite, recode it with APSW as an exercise and see which you prefer. Martin