Reputation: 4660
In Scala, while querying Cassandra, this string interpolation
s"ALTER TABLE ${keyspace}.\"${tableName}\" "
gives me this error:
error: value $ is not a member of String [INFO] val query:String=s"ALTER TABLE ${keyspace}.\"${tableName}\" ADD $colName $dataTypeAsString;"
What am I doing wrong?
Upvotes: 1
Views: 70
Reputation: 44918
The \"
does not work inside string interpolations.
Try using strings delimited by triple quotes:
s"""ALTER TABLE ${keyspace}."${tableName}" """
or escape the inner double quotes by additional ${...}
:
s"ALTER TABLE ${keyspace}.${'"'}${tableName}${'"'} "
Upvotes: 1