Hello,

I have two questions.

First question: How can I subclass Sequel::Model without having DB
connection?

When I do:

class ETLJobSchedule < Sequel::Model
...
end

I get:

/Library/Ruby/Gems/1.8/gems/sequel-3.11.0/lib/sequel/model/base.rb:
125:in `db': No database associated with Sequel::Model (Sequel::Error)
        from /Library/Ruby/Gems/1.8/gems/sequel-3.11.0/lib/sequel/model/
base.rb:191:in `inherited'

I do not know DB connection at the time of Class *declaration* and I
would like to set it up later, for example like this:

ETLJobSchedule.set_dataset(@connecti...@etl_schedules_table])

Second question: How can I have model instances from different
connections?

Example situation: I have more DBs or DB schemas with a table with
same structure. How can I use Sequel::Model with more connections
where the same structure exist?

Two entry points for specifying connection are sufficient for me: one
factory method (that creates model instances) and method for selecting
objects (find).

Something like:
schedule = ETLJobSchedule.new_from_connection(@connection)
schedules = ETLJobSchedule.find_using_connection(@connection, ...)

Something analogous to Core Data where you can have more object stores
for one object model.

How can I do that?

Thanks,

Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to