I am trying to find an ORM to wrap around a legacy database with table and 
column names containing spaces and latin-1 encoded non-ascii characters 
like [Indes du cas] or [Référence correspondant].

Clearly, the right thing to do would be to rename everything according to 
some sensible convention but, unfortunately, this is not an option for the 
moment. 

The database is stored in a Microsoft SQL server and is accessed by a very 
large MS access application. 

I have tested sequel and found with my delight that it is very easy to 
connect to the database and perform queries. I used the 'odbc' adapter as 
in 'odbc:///odbc_name?db_type=mssql'

The problems appear, however, when I try imposing a model. I used the 
following code for modelling a three-level hierarchy: 

class Dossier < Sequel::Model :Dossiers
  set_primary_key ["Index dossier".to_sym]
  many_to_one :cas, :key=>"Index du cas".to_sym
end

class Cas < Sequel::Model
  set_primary_key ["Index du cas".to_sym]
  many_to_one :address, :key=>:IndexduMandant
  one_to_many :dossiers
end

class Address < Sequel::Model :ADRESSES
  set_primary_key ["Index adresse".to_sym]
  one_to_many :cases
end


and i get 

 irb(main):004:0> Address.first.cases
NoMethodError: undefined method `Index adresse' for #<Address:0x26e2e58>
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
 
`block in can_have_associated_objects?'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
 
`each'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
 
`any?'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
 
`can_have_associated_objects?'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1561:in
 
`_load_associated_objects'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1654:in
 
`load_associated_objects'
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1166:in
 
`block in def_association_method'
        from (irb):4
        from 
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/bin/sequel:234:in `<top 
(required)>'
        from C:/Ruby200/bin/sequel:23:in `load'
        from C:/Ruby200/bin/sequel:23:in `<main>'


Any help? 
thank you

Giovanni 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to