kristiandupont / kanel

Generate Typescript types from Postgres
https://kristiandupont.github.io/kanel/
MIT License
829 stars 57 forks source link

Support generating types for foreign tables #560

Open pomdtr opened 1 month ago

pomdtr commented 1 month ago

I'm using steampipe as a way to query cloud apis using sql.

Steampipe use postgresql behind the scene (see https://steampipe.io/docs/develop/overview).

Sadly it looks like kanel is not able to generate types from steampipe foreign tables.

kristiandupont commented 1 month ago

If you can access the underlying Postgres database, you should be able to run Kanel on it.

pomdtr commented 1 month ago

Kanel was able to run on it, but the foreign tables were not included in the output. See the following screenshot:

image

You can list foreign tables in a postgres database by using SELECT * FROM information_schema.foreign_tables;

pomdtr commented 1 month ago

It looks like extract-pg-schema support foreign tables, but kanel does not use them:

kristiandupont commented 1 month ago

Ah they're foreign tables, right. Those are not supported at the moment, that's correct.

alande-amorim commented 1 month ago

@kristiandupont, such feature is of interest for an upcoming project I'll be joining. I'm currently assessing this tool and it's pretty cool. I'd like to help develop this feature. Is it being tracked in any roadmap? How can I contribute?

kristiandupont commented 1 month ago

It ought to be fairly simple, actually. There is no roadmap or anything like that but I am assuming you would want a foreign table to create types exactly like regular tables?