Kotlin / dataframe

Structured data processing in Kotlin
https://kotlin.github.io/dataframe/overview.html
Apache License 2.0
768 stars 48 forks source link

[Feature Request] Read from database and automatically cast to camel case #624

Closed dragove closed 3 months ago

dragove commented 3 months ago

Most of the developers use sneak case in database systems but use camel case in java or kotlin source code.

I hope if there is a convenient way to do auto cast when read data from database.

e.g. if a table has these properties

create table demo(
  id int,
  first_name text,
  last_name text
)

after using val df = DataFrame.readSqlTable(config, "demo", 10, caseConvertor=Convertors.sneakToCamelConvertor) we can access property with camel case df.firstName[0]

Jolanrensen commented 3 months ago

While we cannot do it on read atm, we do have the DataFrame<T>.renameToCamelCase() function. This will also convert snake case to camelCase automatically

dragove commented 3 months ago

Thanks, this worked for me.

Please close this issue if this is one is not planed since it's not important. Or remain this issue if it's worth to implement. Thanks again.