query="""SELECT case when c.table_name= 'built_travels' then 'travels' else 'pointcalls' end as API,
query="""SELECT %s as API,
c.column_name as name,
case when c.table_name= 'built_travels' then 't' else 'p' end||navigo.pystrip(to_char(c.ordinal_position::int, '009')) as shortname,
case when c.table_name= 'built_travels' then 't' else (case when c.table_name= 'port_points' then 'pp' else 'p' end) end||navigo.pystrip(to_char(c.ordinal_position::int, '009')) as shortname,
c.data_type as type, pgd.description as description
FROM information_schema.columns c
left outer join pg_catalog.pg_description pgd on (pgd.objsubid=c.ordinal_position )
left outer join pg_catalog.pg_statio_all_tables st on (pgd.objoid=st.relid and c.table_schema=st.schemaname and c.table_name=st.relname)
where c.table_name in ('%s') and c.table_schema = '%s' and pgd.objoid = st.relid;"""%(table_name,schema)
where c.table_name in ('%s') and c.table_schema = '%s' and pgd.objoid = st.relid;"""%(api,table_name,schema)