[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnubg] python/db issues + minor comment
From: |
Massimiliano . Maini |
Subject: |
[Bug-gnubg] python/db issues + minor comment |
Date: |
Wed, 29 Mar 2006 09:15:23 +0200 |
I tried my python-enabled distribs with respect to sql db interface and
almost everything works fine. I installed SQLite and its python module
(as explained by Jon). Just a few details :
1) I had to edit the file "database" in order to set "gnubg*type sqlite"
(and comment out postgres-only stuff). Also, set "gnubg*database gnubg.db"
(.db extension is recognized by SQLiteAnalyzer and make it clear what the
file contains).
2) I added a couple of analyzed .sgf file to the database using
command-line gnubg and everything went ok : I can run queries
like "select * from nick;" and I see the expected result (I
also tried to run queries via an external tool, SQLiteAnalyzer,
and it works fine). I can also run queries via gnubg gui, but the
thing I cannot do is to add a match to the db via gnubg gui :
it does nothing (no confirmation message in the "status bar" in the
bottom of the window) ... something must be failing ...
3) If I set "gnubg*games yes", then :
(No game) relational add match
Traceback (most recent call last):
File "C:\gnubg-build\gnubg/scripts\database.py", line 721, in addmatch
match_id = self.__add_match(m,env_id,key)
File "C:\gnubg-build\gnubg/scripts\database.py", line 552, in __add_match
match_id = self.__addMatch(nick_id0, nick_id1, m, key)
File "C:\gnubg-build\gnubg/scripts\database.py", line 525, in __addMatch
self.__addgames( nick_id0, nick_id1, m, match_id)
File "C:\gnubg-build\gnubg/scripts\database.py", line 449, in __addgames
cursor.execute(query)
pysqlite2.dbapi2.OperationalError: no such table: game
In fact, database.py always "parses" gnubg.sql when creating the database :
it should parse "gnubg.game.sql" if self.games is true.
In scripts/database.py (Line 601) :
# Open file which has db create sql statments
sqlfile = open("gnubg.game.sql", "r")
should probably be :
# Open file which has db create sql statments
if self.games :
sqlfile = open("gnubg.game.sql", "r")
else :
sqlfile = open("gnubg.sql", "r")
4) After this change, it seems to run fine, but once a match imported,
I'm unable to acces the "game" table. From gnubg command-line prompt I
do :
relational select * from game
and it says "Error running query".
Also, if I try thesame in SQLiteAnalyzer, I have an error message saying
"SQL error or missing database no such table: game" : that's very
funny because in the graphical representation of the db I do see a
table named "game" ...
Note that I'm also unable to access "gamestat" table (same error messages)
while I can access all the other tables (control, enc, nick, match etc.)
MaX.
P.S.
Minor detail : I played a 1pt match and lost it 2-0. The dialog at the end
of the match is :
gnubg wins a gammon and 2 points.
the score (after 1 game) is: gnubg 2, MaX 0 (match to 1 point,
post-Crawford play).
gnubg has won the match.
Probably unnecessary to give details like "post-crawford" when the match is
over,
it's very irritating for the loser :))
- [Bug-gnubg] python/db issues + minor comment,
Massimiliano . Maini <=