kszucs / pandahouse

Pandas interface for Clickhouse database
MIT License
228 stars 70 forks source link

Create table from dataframe? #31

Open EgorKraevTransferwise opened 3 years ago

EgorKraevTransferwise commented 3 years ago

Is there a way to automatically create a table matching the column types of a dataframe, similar to pandas.DataFrame.to_sql()?

timfeirg commented 3 years ago

i can see that there's no such function currently. but is this feature welcomed? can I send a PR if I managed to implement it? @kszucs

kszucs commented 3 years ago

Definitely!

9en9i commented 3 years ago

@timfeirg is it done?

timfeirg commented 3 years ago

there's this package https://github.com/cloudflare/sqlalchemy-clickhouse that already can generate create table statements, I've tried but it is clearly not finished yet, but we're better off improving things in that repo, because pandas already supports sqlalchemy.

kszucs commented 3 years ago

Note that this package will switch to use columnar output formats in the future, once clickhouse extends its type support for these formats, see https://github.com/kszucs/pandahouse/issues/29 for reference.