steampipe-postgres-fdw
steampipe-postgres-fdw copied to clipboard
convenience function to stand in for `.inspect`?
Could do this in steampipe_postgres_fdw_github--1.0.sql
drop function if exists steampipe_fdw_schema
create function steampipe_fdw_schema(schema text, table_name text) returns table (
column_name_and_type text
) as $$
select distinct
column_name || ': ' || data_type as column_name_and_type
from
information_schema.columns
where
table_name = table_name and
table_schema = schema
order by
column_name_and_type
$$ language sql;
then:
select steampipe_fdw_schema('github', 'github_issue');
steampipe_fdw_schema
----------------------------------------------------------
_ctx: jsonb
action: text
active_lock_reason: text
actor: jsonb
actor: text
actor_location: jsonb
actor_login: text
additions: bigint
affiliation: text
alert_number: bigint
allow_update_branch: boolean
Much nicer than looking up and using some version of the underlying query.