Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


table name with double underscore #590

lukeholder opened this Issue · 4 comments

1 participant


The following connects successfully to the database:

require "rubygems"
require "sequel"

DB = Sequel.connect(
    :adapter => "tinytds",
    :username => 'sa',
    :password => 'Doric101',
    :host => '',
    :database => 'ADCData_Doric'

Running manual SQL queries works but the code here:

prm_master__employee = DB.from(:prm_master__employee)

prm_master__employee.each do |r|
    puts r.employee

results in the error:

/Users/lukeholder/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/adapters/tinytds.rb:221:in `fields': TinyTds::Error: Invalid object name 'PRM_MASTER.EMPLOYEE'. (Sequel::DatabaseError)
    from /Users/lukeholder/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/adapters/tinytds.rb:221:in `block in fetch_rows'
    from /Users/lukeholder/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/adapters/tinytds.rb:68:in `block in execute'

Obviously the tinytds adadper is looking for a table PRM_MASTER.EMPLOYEE but the table does not have a dot.

Any assistance would be appreciated.


ok, looking at documentation further, the double underscore is actually a notation created as a part of the Qualifying identifiers of sequel. Any way around this, as the table cannot be renamed to not contain double underscores?

I tried this which should be a valid symbol but it doesn't work either:


I suppose what I am asking is a way to use double underscores in a table name without it thinking im looking to make it a qualified query.


Additional question:

why does

class Employees < Sequel::Model(:prm_master__employee)


puts Employees.table_name

print out


but Employee.all fails with

 Invalid object name 'PRM_MASTER.EMPLOYEE'

issue solved with


@lukeholder lukeholder closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.