简体   繁体   English

如何使用 HDBC 获取完整的(er)表模式

[英]How to get full(er) table schema with HDBC

HDBC beginner here. HDBC 初学者在这里。 I'd like to view schemas for my tables.我想查看我的表的模式。 I know I can use describeTable to get the SqlColDesc for each table, but I'd also like to see primary and foreign keys, which SqlColDesc doesn't contain.我知道我可以使用describeTable获取每个表的SqlColDesc ,但我还想查看SqlColDesc不包含的主键和外键。 Is there a way to access this information with HDBC or another Haskell interface?有没有办法用 HDBC 或另一个 Haskell 接口访问这些信息?

Update: I realized I could access the information with a query.更新:我意识到我可以通过查询访问信息。 Since I'm using the Sqlite3 backend for HDBC, the SQL is由于我为 HDBC 使用 Sqlite3 后端,因此 SQL 是

select sql
from sqlite_master
where type="table";

I'll still have to extract the relevant metadata, since there don't seem to be any convenience functions for that.我仍然需要提取相关的元数据,因为似乎没有任何方便的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM