使用 Sequel Gem 访问 Postgresql 模式

问题描述 投票:0回答:1

我正在尝试访问我的 postgresql 数据库中的某个模式。

发现这个相关问题:

如何使用 Sequel gem 在特定的 Postgres 模式中创建表?

它还在文档中引用:

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

但是运行时它总是将第一个符号限定为表,将第二个符号限定为列:

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

当我使用三个符号时,第三个符号被限定为第二列:

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

不确定我错过了什么?

sequel
1个回答
0
投票

我在这个问题上找到了一些解决方法:

如何使用 Sequel 插入 Postgres 架构中的表?

这是我使用的两个:

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

DB = Sequel.connect(adapter, host, database, search_path: "some_schema", user, password)
© www.soinside.com 2019 - 2024. All rights reserved.