You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/idea-examples/unsupported-data-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/exposed/compatibilityLayer.kt
Copy file name to clipboardExpand all lines: examples/idea-examples/unsupported-data-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/exposed/main.kt
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -58,15 +58,16 @@ fun main() {
58
58
59
59
// or make plots using Kandy! It's all up to you
60
60
61
-
// writing a DataFrame back into an SQL database with Exposed can also be done!
61
+
// writing a DataFrame back into an SQL database with Exposed can also be done easily!
62
62
transaction(db) {
63
63
addLogger(StdOutSqlLogger)
64
64
65
65
// first delete the original contents
66
66
Customers.deleteAll()
67
67
68
-
// batchinsert our rows back into the SQL database
68
+
// batch-insert our dataframe back into the SQL database as a sequence of rows
69
69
Customers.batchInsert(df.asSequence()) { dfRow ->
70
+
// we simply go over each value in the row and put it in the right place in the Exposed statement
Copy file name to clipboardExpand all lines: examples/idea-examples/unsupported-data-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/exposed/tables.kt
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,7 @@ object Customers : Table() {
51
51
* This is what we created the [toDataFrameSchema] function for!
52
52
*/
53
53
funmain() {
54
-
val columnNameToAccessor = mutableMapOf<String, String>()
55
-
val schema =Customers.toDataFrameSchema(columnNameToAccessor)
54
+
val (schema, nameNormalizer) =Customers.toDataFrameSchemaWithNameNormalizer()
56
55
57
56
// checking whether the schema is converted correctly.
58
57
// schema.print()
@@ -62,7 +61,7 @@ fun main() {
62
61
// while keeping the correct column names
63
62
schema.generateDataClasses(
64
63
name ="CustomersDf",
65
-
nameNormalizer =NameNormalizer { columnNameToAccessor[it] ?: it },
Copy file name to clipboardExpand all lines: examples/idea-examples/unsupported-data-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/kotlinSpark/typedDataset.kt
0 commit comments