File tree 2 files changed +5
-2
lines changed
src/main/scala/org/embulk/input/firestore
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 2
2
type : firestore
3
3
project_id : " syucream-firebase-dev"
4
4
json_keyfile : credential.json
5
- sql : " SELECT name FROM users"
5
+ sql : " SELECT id, name FROM users"
6
6
7
7
out :
8
8
type : stdout
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.embulk.input.firestore
3
3
import java .io .FileInputStream
4
4
import java .util
5
5
6
+ import com .fasterxml .jackson .databind .ObjectMapper
6
7
import com .google .auth .oauth2 .GoogleCredentials
7
8
import com .google .cloud .firestore .Firestore
8
9
import com .google .firebase .cloud .FirestoreClient
@@ -20,6 +21,7 @@ case class FirestoreInputPlugin() extends InputPlugin {
20
21
private val TASK_COUNT = 1
21
22
22
23
private val jsonParser = new JsonParser ()
24
+ private val objectMapper = new ObjectMapper ()
23
25
24
26
override def transaction (
25
27
config : ConfigSource ,
@@ -74,7 +76,8 @@ case class FirestoreInputPlugin() extends InputPlugin {
74
76
val col = pageBuilder.getSchema.getColumn(0 )
75
77
76
78
query.get.getDocuments.forEach { d =>
77
- pageBuilder.setJson(col, jsonParser.parse(d.toString))
79
+ val json = objectMapper.writeValueAsString(d.getData)
80
+ pageBuilder.setJson(col, jsonParser.parse(json))
78
81
pageBuilder.addRecord()
79
82
}
80
83
pageBuilder.finish()
You can’t perform that action at this time.
0 commit comments