File tree 1 file changed +7
-2
lines changed
cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,20 @@ case class GcpFormatProvider(sparkSession: SparkSession) extends FormatProvider
41
41
override def writeFormat (tableName : String ): Format = {
42
42
43
43
val tu = TableUtils (sparkSession)
44
+ val isTableReachable = tu.tableReachable(tableName)
44
45
val sparkOptions : Map [String , String ] =
45
46
Map (
46
- " partitionField" -> tu.partitionColumn,
47
47
" temporaryGcsBucket" -> sparkSession.conf.get(
48
48
" spark.chronon.table.gcs.temporary_gcs_bucket"
49
49
), // todo(tchow): No longer needed after https://github.com/GoogleCloudDataproc/spark-bigquery-connector/pull/1320
50
50
" writeMethod" -> " indirect"
51
51
)
52
- BQuery (bqOptions.getProjectId, sparkOptions)
52
+
53
+ if (isTableReachable) {
54
+ BQuery (bqOptions.getProjectId, sparkOptions + (" partitionField" -> tu.partitionColumn))
55
+ } else {
56
+ BQuery (bqOptions.getProjectId, sparkOptions)
57
+ }
53
58
}
54
59
55
60
private def format (tableName : String ): Format = {
You can’t perform that action at this time.
0 commit comments