IRC log for #storm on 20101117

00:11.05*** join/#storm fcorrea (~fcorrea@189-54-100-52-nd.cpe.vivax.com.br)
00:11.11*** join/#storm hamush (~hamush@184-219-59-194.pools.spcsdns.net)
02:26.26*** join/#storm m4v (~znc@unaffiliated/m4v)
02:39.56*** join/#storm jamesh_ (~james@canonical/launchpad/jamesh)
04:22.35*** join/#storm jcsackett (~jcsackett@cpe-098-122-187-054.nc.res.rr.com)
05:03.23*** join/#storm m4v (~znc@unaffiliated/m4v)
07:42.06*** join/#storm stub (~stub@canonical/launchpad/stub)
08:12.51*** join/#storm wallyworld (~quassel@27-33-46-253.static.tpgi.com.au)
08:40.43*** join/#storm zmijunkie (~sascha@business-188-111-082-104.static.arcor-ip.net)
09:02.09*** join/#storm danilos (~danilo@static-213-198-236-193.adsl.eunet.rs)
09:02.09*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
09:06.11*** join/#storm bigjools (~quassel@82-71-93-254.dsl.in-addr.zen.co.uk)
09:06.11*** join/#storm bigjools (~quassel@canonical/launchpad/bigjools)
10:59.28*** join/#storm danilo_ (~danilo@cable-89-216-142-130.dynamic.sbb.rs)
11:01.40*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
11:25.22*** join/#storm niemeyer (~niemeyer@189-10-175-46.pltce701.dsl.brasiltelecom.net.br)
12:05.06*** join/#storm fcorrea (~fcorrea@187.3.31.9)
12:14.39*** join/#storm stub (~stub@ppp-58-8-15-106.revip2.asianet.co.th)
12:14.39*** join/#storm stub (~stub@canonical/launchpad/stub)
12:50.15*** join/#storm jamesh_ (~james@canonical/launchpad/jamesh)
13:05.44*** join/#storm jcsackett (~jcsackett@cpe-098-122-181-157.nc.res.rr.com)
13:57.35*** join/#storm shaunm (~shaunm@74.83.18.167)
14:27.49*** join/#storm gary_poster (~anonymous@199.72.57.72)
14:29.40*** join/#storm keppla (~keppla@i577B264A.versanet.de)
14:57.43*** join/#storm gary_poster (~anonymous@199.72.57.72)
15:22.08*** part/#storm jcsackett (~jcsackett@cpe-098-122-181-157.nc.res.rr.com)
16:32.53*** join/#storm jamesh_ (~james@canonical/launchpad/jamesh)
17:17.39*** join/#storm keppla (~keppla@i577B264A.versanet.de)
17:31.16*** join/#storm gary_poster (~anonymous@71.16.235.2)
20:19.11*** join/#storm glogiotatidis (~seadog@z039179.its-s.tudelft.nl)
20:19.13glogiotatidishello
20:20.47glogiotatidisI have an issue with storm and sqlite. I'm trying to do an store.execute("PRAGMA foreign_keys = ON;") and although I get no error the command does nothing
20:21.08glogiotatidiswhen using from sqlite3 program of course it works. Any ideas on what I'm doing wrong?
20:26.31marienzglogiotatidis: "This pragma is a no-op within a transaction"
20:26.59glogiotatidismarienz, aha and how can I do it outside a transaction?
20:27.56marienzthat is a good question
20:27.56marienzsec
20:28.07glogiotatidis;) thnx!
20:30.04marienzwhat would work and *might* be the most sensible approach is to subclass storm.databases.sqlite.SQLITE and extend raw_connect to set it the same way it's currently setting PRAGMA synchronous
20:31.54glogiotatidismarienz, aha I get it. Sounds a bit like a hack tough but it looks like something that will work
20:32.05glogiotatidismarienz, thnx for your time, I will try it right away
20:32.27marienzif you look at SQLiteConnection.raw_execute you'll see that storm is always inside a transaction (it BEGINs a transaction for any call to raw_execute other than its internal commit/rollback calls)
20:33.22bob2eep, i never noticed that was off by default
20:33.45glogiotatidisbob2, yes it's off due to compatibility reasons
20:33.52marienzI guess you could abuse the _end kwarg to raw_execute, or grab the underlying _raw_connection (dbapi connection) and use that directly, but those both seem messier to me than extending SQLite.raw_connect (which has a chance to initialize the dbapi connection before storm's connection object gets constructed, which is really what you want here imho)
20:34.32marienzbob2: it's off because sqlite only parsed but had no support for enforcing foreign keys for a long while, so it might break apps that set forein keys but were lax about following them
20:34.47bob2fair enough
20:35.10glogiotatidisaha ic. Stupid question maybe but if I subclass SQLite() can I instruct storm to use my object instead of the default object ?
20:35.11marienz(support was added in 3.6.19 released 2009 Oct 14)
20:35.29marienzglogiotatidis: that I haven't thought about yet
20:35.59glogiotatidis:/
20:36.57marienzglogiotatidis: storm.database.register_scheme looks promising
20:38.16glogiotatidismarienz, so I can create a new dbscheme e.g. sqliteforeignkeys and point to the new class?
20:38.24marienznods
20:39.13marienzor you can register the 'sqlite' scheme, which ends up taking precedence over the standard implementation, and only actually turn on foreign keys if the right option is passed in the uri
20:39.18marienznot sure which I'd prefer
20:39.39marienzthat is: do the exact same thing they do for the synchronous pragma
20:39.52glogiotatidisyap I get it
20:40.15glogiotatidisI will play around a bit and post updates here
20:43.17bob2would that be worth patching in to storm's sqlite module?
20:48.51*** join/#storm gary_poster (~anonymous@199.72.57.72)
20:59.16*** join/#storm infobot (~infobot@rikers.org)
20:59.16*** topic/#storm is The Storm Python ORM - http://storm.canonical.com/ - 0.18 released! || Review branches: https://code.launchpad.net/storm/+activereviews || IRC logs: http://ibot.rikers.org/#storm/ || API documentation: http://people.canonical.com/~jkakar/storm/
21:00.01marienzglad to hear it
21:00.07marienzbob2: I was about to suggest that :)
21:00.27marienzglogiotatidis: perhaps patch this into storm proper and file a bug? :)
21:01.00glogiotatidishttp://pastebin.com/b2Ab4Bz3 for anyone interested
21:01.21glogiotatidismarienz, yes that is something I will do asap
21:01.27glogiotatidisthnx again for your time
21:02.27marienzglogiotatidis: instead of overriding raw_connect I'd extend it (def raw_connect(self): raw_connection = SQLite.raw_connect(self); raw_connection.execute('PRAGMA foreign_keys = ON'); return raw_connection)
21:02.50marienzglogiotatidis: this also lets you omit that nested try/except ImportError block, as you no longer need to use the dbapi module yourself :)
21:03.31glogiotatidisaha nice suggestion
21:09.06*** join/#storm wallyworld (~quassel@27-33-46-253.static.tpgi.com.au)
21:22.18glogiotatidissee bug report with included patch https://bugs.launchpad.net/storm/+bug/676702
21:22.19_mup_Bug #676702: Foreign Keys support for SQLite <sqlite> <Storm:New> <https://launchpad.net/bugs/676702>
21:22.48glogiotatidismarienz, thanks again for your time. going back to do what I was originally supposed to do ;) bb
21:23.14marienzyes, that's what I had in mind patch-wise :) thanks!
21:24.05marienz(I guess it'd need a test before it could get merged though)
21:36.08*** join/#storm fcorrea (~fcorrea@189-54-100-52-nd.cpe.vivax.com.br)
21:45.29*** join/#storm keppla (~keppla@i577B264A.versanet.de)
22:02.46*** join/#storm glogiotatidis (~seadog@b81161.upc-b.chello.nl)
22:48.57*** join/#storm jamesh_ (~james@canonical/launchpad/jamesh)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.