Access Postgresql Schema with Sequel Gem

58 Views Asked by At

I am trying to access a certain schema in my postgresql database.

Found this related question:

How to create a table in a particular Postgres schema with Sequel gem?

And it also references in the docs:

https://github.com/jeremyevans/sequel#label-Qualifying+identifiers+-28column-2Ftable+names-29

But when running it always qualifies the first symbol as the table and the second as the column:

Sequel[:schema][:table]
=> #<Sequel::SQL::QualifiedIdentifier @table=>"schema", @column=>:table>

And when I use three symbols the third is qualified as a second column:

Sequel[:schema][:table][:column]
=> #<Sequel::SQL::QualifiedIdentifier @table=>#<Sequel::SQL::QualifiedIdentifier @table=>"schema", @column=>:table>, @column=>:column>

Not sure what I am missing?

1

There are 1 best solutions below

0
Justinus Adriaanse On BEST ANSWER

I found some work arounds on this question:

How to INSERT in a table that is in a Postgres schema with Sequel?

Here the two the I used:

DB.from{schema[:table]} # SELECT * FROM schema.table

and

DB = Sequel.connect(adapter, host, database, search_path: "some_schema", user, password)