The table I’m trying to query is named is cache.dashboardstats
my model is:
class Dashboard < Sequel::Model(:dashboardstats)
set_schema do
set_primary_key :dashboardstatid
end
end
This creates a select * from "dashboardstats";
How do I define the owner/schema of “cache” so that my query becomes:
select * from cache."dashboardstats";
You can use a double underscore inside a symbol, or one of the qualify methods to represent a qualified identifier:
You would use this in your model code like:
Note that I left out your set_schema call. You should never call set_schema unless you are calling create_table or a similar method, as otherwise it does nothing. set_primary_key inside set_schema doesn’t do what you think, and Sequel can usually determine the primary key correctly, so it’s not normally specified manually.