Skip to content

Commit

Permalink
Quote column names in Redshift load statements
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Dec 14, 2023
1 parent dbabd2d commit 2f46859
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ object Redshift {
val frMaxError = Fragment.const0(maxError.toString)
val frCompression = getCompressionFormat(compression)
val columns = shredModel.entries.map(_.columnName)
val frColumns = Fragment.const0((ShredModelEntry.commonColumnNames ::: columns).mkString(","))
val frColumns = Fragment.const0((ShredModelEntry.commonColumnNames ::: columns).map(quoted).mkString(","))

shreddedType match {
case ShreddedType.Json(_, jsonPathsFile) =>
Expand Down Expand Up @@ -368,4 +368,6 @@ object Redshift {
case _: LoadAuthMethod.TempCreds.Azure =>
throw new IllegalStateException("Azure temp credentials can't be used with Redshift")
}

private def quoted(str: String): String = s""""$str""""
}

0 comments on commit 2f46859

Please sign in to comment.