[storm] How can I make my own "store"?
James Henstridge
james at jamesh.id.au
Wed Sep 23 16:09:38 BST 2009
On Wed, Sep 23, 2009 at 9:10 AM, Jason Baker <jbaker at zeomega.com> wrote:
> I'm having a bit of a problem. For some of our data, we need to use bulk
> loading (in this case SQL*Loader). What I'd like to do is come up with some
> kind of object that we can drop in instead of the store that will handle the
> bulk loading. That's the easy part.
> The hard part is in making storm recognize this new object. Consider the
> following example:
> class A(object):
> a_id = Int(primary=True)
> class B(object):
> b_id = Int(primary=True)
> a_id = Int()
> a = Reference(a_id, A.a_id)
> some_b = store.find(B, ...)
> some_a = A()
> some_b.a = some_a
> As I understand it, the last line will add some_a to the store it was pulled
> from (although I may have the reference relationship the wrong way around).
> This can have disastrous results when working with SQL*Loader as it could
> result in the object getting inserted via the store and getting inserted via
> the bulk inserter.
> Is there any way to make this work? I'm guessing that I could make the
> object belong to my store if I add it under a "store" key in obj_info. Is
> it worth attempting this, or is there a better way to do this?
I'm not quite sure I understand your problem.
If you are using a bulk loader tool to insert data into the database
outside of Storm's control, wouldn't you want to retrieve it via
store.get() or store.find()? If you're instantiating a new object,
then Storm will issue an INSERT to add the new row.
James.
More information about the storm
mailing list