列出Snowflake中特定表中具有数据类型的所有列 [英] List all columns wtih datatype in specific table in Snowflake

查看:15
本文介绍了列出Snowflake中特定表中具有数据类型的所有列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找获得Snowflake表架构的编程方法,有办法吗?

推荐答案

使用此查询:

select ordinal_position as position,
       column_name,
       data_type,
       case when character_maximum_length is not null
            then character_maximum_length
            else numeric_precision end as max_length,
       is_nullable,
       column_default as default_value
from information_schema.columns
where table_schema ilike 'schema' -- put your schema name here
       and table_name ilike 'table'  -- put your table name here
order by ordinal_position;
请注意,这将产生成本,因为它将需要运行的仓库。如果您正在寻找免费的解决方案,请查看Nathan Griffiths‘answer。如果您正在寻找基于查询的可预测解决方案,您可以使用此答案。

这篇关于列出Snowflake中特定表中具有数据类型的所有列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆