diff --git a/integration/src/test/scala/com/spotify/scio/bigquery/BigQueryClientIT.scala b/integration/src/test/scala/com/spotify/scio/bigquery/BigQueryClientIT.scala index f6eb776775..02d2914e66 100644 --- a/integration/src/test/scala/com/spotify/scio/bigquery/BigQueryClientIT.scala +++ b/integration/src/test/scala/com/spotify/scio/bigquery/BigQueryClientIT.scala @@ -56,7 +56,8 @@ class BigQueryClientIT extends AnyFlatSpec with Matchers { val table = bq.tables.createTemporary(location = "EU").getTableReference val tableRef = bq.load.json(sources, table.asTableSpec, schema = Some(schema)) tableRef.map { ref => - val insertQuery = s"insert into `${ref.asTableSpec}` values (1603, 'alien', 9000, 'alien')" + val insertQuery = s"""insert into `${ref.asTableSpec}` + |values (1603, 'alien', 9000, 'alien')""".stripMargin bq.query.run( insertQuery, createDisposition = null, diff --git a/scio-google-cloud-platform/src/main/scala/com/spotify/scio/bigquery/client/BigQuery.scala b/scio-google-cloud-platform/src/main/scala/com/spotify/scio/bigquery/client/BigQuery.scala index eefb81fe6c..bebbadfba6 100644 --- a/scio-google-cloud-platform/src/main/scala/com/spotify/scio/bigquery/client/BigQuery.scala +++ b/scio-google-cloud-platform/src/main/scala/com/spotify/scio/bigquery/client/BigQuery.scala @@ -166,7 +166,7 @@ final class BigQuery private (val client: Client) { /** Companion object for [[BigQuery]]. */ object BigQuery { private[scio] def isDML(sqlQuery: String): Boolean = - sqlQuery.toUpperCase().matches("(UPDATE|MERGE|INSERT|DELETE).*") + sqlQuery.toUpperCase().matches("(?s)(UPDATE|MERGE|INSERT|DELETE).*") private lazy val instance: BigQuery = BigQuerySysProps.Project.valueOption.map(BigQuery(_)).getOrElse {