00:00.38 | *** join/#storm danilos (~danilo@canonical/launchpad/danilos) |
00:00.57 | midgetspy | I have Foo with primary key (a, b, c) and Bar with primary key d. I want to build a M<->M relationship between the two objects, so I have a link object with keys a, b, c, d. I then tried passing all 4 pairs into ReferenceSet but get an exception due to too many arguments to the constructor. what's the proper way to do this? |
01:17.44 | *** join/#storm danilos (~danilo@canonical/launchpad/danilos) |
02:13.38 | *** join/#storm bob2_ (rob@egads.ertius.org) |
02:29.28 | midgetspy | how does storm handle multithreading (with sqlite)? should I be using a lock for the store object? |
05:29.04 | *** join/#storm bob2 (rob@unaffiliated/bob2) |
05:46.48 | *** join/#storm jukart (lovely@81.189.156.94) |
06:43.27 | *** join/#storm hazmat (~kapil@64.126.138.247) |
07:20.41 | *** join/#storm stub (~stub@canonical/launchpad/stub) |
08:57.40 | *** join/#storm zmijunkie (~chatzilla@i59F5F2D5.versanet.de) |
12:15.45 | *** join/#storm salgado (~salgado@canonical/launchpad/salgado) |
12:44.09 | *** join/#storm fcorrea (~fcorrea@187.3.154.39) |
12:53.56 | *** join/#storm niemeyer (~niemeyer@201-40-138-24.pltce701.dsl.brasiltelecom.net.br) |
13:23.31 | *** join/#storm elmom (~elmom@hoasnet-fe29dd00-137.dhcp.inet.fi) |
13:29.46 | *** join/#storm bac (~bac@cpe-065-190-186-163.nc.res.rr.com) |
13:29.46 | *** join/#storm bac (~bac@canonical/launchpad/bac) |
14:35.02 | midgetspy | I have Foo with primary key (a, b, c) and Bar with primary key d. I want to build a M<->M relationship between the two objects, so I have a link object with keys a, b, c, d. I see that ReferenceSet only takes two pairs, so how do I make a relationship with more keys than that? |
14:35.16 | midgetspy | also how does storm handle multithreading (with sqlite)? should I be using a lock for the store object? |
14:36.48 | therve | 1) you don't really have multiple keys, you have a compound key |
14:37.06 | therve | the first key being (a, b, c), the second one d |
14:37.56 | therve | 2) storm doesn't "handle" multiplethreading specifically. It is threadsafe. If you use sqlite, you may need to have only store with locks around it indeed |
14:40.48 | midgetspy | therve: how can I make ReferenceSet with a compound key then? |
14:41.21 | therve | midgetspy: pass (a, b, c) as first argument and d as second? |
14:41.28 | midgetspy | hm |
14:41.38 | midgetspy | I'll give it a try, thanks |
14:46.21 | *** join/#storm skrite (~skrite@pivotrac.texaspivot.com) |
14:57.20 | skrite | hey all |
15:03.14 | therve | hey you |
15:06.05 | skrite | i recently upgraded our operating system on our server from ubuntu 8.10 to 9.10 | i also moved from MyISAM to InnoDB. ever since, i have been getting, a few times a day, an error regarding Dead Lock while trying to read. |
15:06.17 | skrite | Any gotchas i might need to know about? |
15:07.20 | therve | so, storm shouldn't even run on MyISAM? or at least it doesn't do transaction |
15:07.35 | therve | the error you get looks mysql specific, unfortunately |
15:10.11 | skrite | ok |
15:11.24 | skrite | actually i did run storm on MyISAM. Even though it was not recommended. due to a bug in the InnoDB regarding row-locking that existed at the time. Storm did a great job. |
15:11.45 | skrite | better than advertized :0 |
15:12.05 | skrite | so i will look into the MySQL problem. |
15:37.11 | *** join/#storm danilos (~danilo@canonical/launchpad/danilos) |
15:51.53 | *** join/#storm elmom (~elmom@62.236.159.117) |
15:57.15 | *** join/#storm stub1 (~stub@ppp-58-8-211-171.revip2.asianet.co.th) |
15:57.18 | *** join/#storm stub (~stub@canonical/launchpad/stub) |
16:04.05 | *** join/#storm salgado (~salgado@canonical/launchpad/salgado) |
16:44.53 | *** join/#storm danilos (~danilo@canonical/launchpad/danilos) |
16:52.03 | midgetspy | so when exactly does storm start a transaction? If I change a property value on an object in memory does a transaction start then? or only if it's been flushed? (I'm wondering when I will have to be committing to avoid having my db locked for long periods of time) |
17:25.56 | midgetspy | so when exactly does storm start a transaction? If I change a property value on an object in memory does a transaction start then? or only if it's been flushed? (I'm wondering when I will have to be committing to avoid having my db locked for long periods of time) |
17:25.59 | midgetspy | grr sorry again |
17:26.21 | midgetspy | keep tabbing to the wrong window and pressing up-enter :-| |
17:40.40 | jkakar | midgetspy: Storm starts transactions automatically. |
17:40.50 | jkakar | midgetspy: They stop when you call store.commit or store.rollback. |
17:42.42 | midgetspy | jkakar: right, when do they start though? can i change a value on something in memory without starting a transaction? |
17:44.09 | jkakar | midgetspy: They start when the first statement is executed. |
17:44.23 | jkakar | midgetspy: This can happen because Storm flushes queries, sending them to the database. |
17:44.35 | jkakar | midgetspy: Or when you call store.flush() and no automatic flush has occurred. |
17:44.48 | jkakar | midgetspy: Or when you call store.execute() and no automatic flush has occurred. |
17:44.52 | jkakar | midgetspy: IOW, it's hard to tell when they start. |
17:45.30 | jkakar | midgetspy: You're using SQLite, right? |
17:45.48 | midgetspy | yes |
17:45.51 | jkakar | midgetspy: You can see where this happens in the code at storm/databases/sqlite.py, specifically in SQLiteConnection.raw_execute. |
17:46.23 | midgetspy | ok I will look into it, thanks |
17:51.41 | midgetspy | hmm, I've got an object with a property that's a ReferenceSet and when I do print myObj.theproperty.count(); myObj.theproperty.add(another); print myObj.theproperty.count() it prints 0 then 2 (it adds it twice). any idea where I should start troubleshooting that? |
17:59.17 | midgetspy | ah never mind, I was creating a second object when I tried adding it rather than using store.find to retrieve the existing object |
18:06.23 | *** join/#storm keppla (~keppla@i577B1959.versanet.de) |
18:28.17 | *** join/#storm mup_ (~mup@li37-90.members.linode.com) |
18:46.35 | midgetspy | Is there a storm function to retrieve an object by primary key or create one if it doesn't exist or should I be doing that logic myself? I thought creating a new object with the primary key I want might just load the values from the DB but I get a key error instead |
19:47.55 | *** join/#storm yosafbridge (~yosafbrid@li14-39.members.linode.com) |
21:19.19 | jkakar | midgetspy: Nope, no such function. |
21:19.45 | jkakar | midgetspy: You can use store.get(ClassType, key_value) to get an object by primary key, but it returns None if the matching object isn't in the database. |
21:20.09 | jkakar | midgetspy: It's preferable to store.find(ClassType, ClassType.id == key_value).one() when you only want to fetch a single object because, if the object is in Storm's cache, it won't execute a query. |
21:20.26 | jkakar | midgetspy: Store.find always executes a query, even if the objects that end up getting returned are from the cache. |
21:25.44 | midgetspy | thanks jkakar |
21:25.52 | jkakar | midgetspy: np |
21:26.30 | midgetspy | is there any way to proxy attributes from a Reference'd object? |
21:26.53 | midgetspy | (aside from manually doing it with __setattr__() and __getattr__()) |
21:28.12 | midgetspy | eg. Outer has an attribute foo which is a Reference() to a type Inner. I'd like to access foo's attributes through Outer like outer.myattr rather than outer.foo.myattr |
21:31.38 | *** join/#storm danilo_ (~danilo@static-213-198-236-193.adsl.eunet.rs) |
21:36.56 | jkakar | midgetspy: Nope. |
21:39.57 | midgetspy | hmm |
21:45.03 | midgetspy | I guess storm uses __getattr__ too so I can't do it that way either... doh |
21:46.52 | midgetspy | ah well, I can type the extra attribute level :0) |
21:56.03 | *** join/#storm shaunm (~shaunm@c-98-212-133-244.hsd1.il.comcast.net) |
23:04.53 | *** join/#storm jamesh (~james@canonical/launchpad/jamesh) |
23:28.08 | *** join/#storm fcorrea (~fcorrea@201-75-152-196-nd.cpe.vivax.com.br) |