Tencent / APIJSON

🏆 实时 零代码、全功能、强安全 ORM 库 🚀 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构 🏆 Real-Time coding-free, powerful and secure ORM 🚀 providing APIs and Docs without coding by Backend, and the returned JSON of API can be customized by Frontend(Client) users
http://apijson.cn
Other
17.3k stars 2.16k forks source link

查询库表字段信息 #695

Closed Xuxin19960702 closed 7 months ago

Xuxin19960702 commented 8 months ago

Description

想要查询库表的字段和字段的comment。

sql语句如下: SELECT column_name, column_comment FROM information_schema.columns WHERE table_schema = 'your_database_name' AND table_name = 'your_table_name';

自己测试尝试了已有语法的组合,并未实现此功能,特地来请教大佬。

TommyLemon commented 8 months ago

数据库基础属性表已提供: Table -> information_schema.tables Column -> information_schema.columns

当然也可以在 Access 表里注册下: table='tables', alias='Tables' table='columns', alias='Columns'

image

http://apijson.cn/api/?send=true&type=JSON&url=http%3A%2F%2Fapijson.cn%3A8080%2Fget&json={%22[]%22:{%22Column%22:{%22@column%22:%22column_name%2Ccolumn_comment%22,%22@schema%22:%22information_schema%22,%22table_schema%22:%22sys%22,%22table_name%22:%22Comment%22}},%22@explain%22:true}

可以在 APIAuto 网页抓包看到对 MySQL, PostgreSQL, Oracle, SQLServer 等主流数据库详细的 表、字段 属性等查询 JSON https://github.com/Tencent/APIJSON/issues/85#issuecomment-486917638

Xuxin19960702 commented 7 months ago

懂了,感谢大佬!