No primary key in the database? Is that an issue with the odbc driver?
I renamed a few things and added error catching:

class Order < Sequel::Model(:Order)
  one_to_many :itemlist, :key => :order, :class => :OrderItem
  one_to_one :cust, :key => :customer, :class => :Customer
end

class Orderitem < Sequel::Model(:OrderItem)
  many_to_one :theorder, :key => :order, :class => :Order
end

class Customer < Sequel::Model(:Customer)
  many_to_one :orderlist, :key => :orderid, :class => :Order
end

Then I dumped the schema for the Order table. None of the fields show
as primary_key (or key for that matter)

Then I do this
Order.all.each do |r|
  begin
    ocust = r.cust_dataset               <------- BOOM
    puts ocust.sql                            <------- not reached
  rescue Exception => e
    pp e                                           <------  Jumps here
  end
end

The  ocust = r.cust_dataset line raises an exception.
#<Sequel::Error: model object #<Order @values={ ... all the key/values
in that record } > does not have a primary key>
If I look at the schema def from my browser, the table has one primary
key (OID) as well as a few foreign keys, Customer being one of them.
Looking at the log, that browser uses a jdbc driver, so different than
odbc used by sequel.
Can I specify a key in my model definition? (It isn't obvious to me
how to do that)


-- 
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