Hello,
I am having some issues with the Cassandra python driver. I was originally using the query
conn.execute(f"CREATE KEYSPACE IF NOT EXISTS {db_name} WITH REPLICATION = { { 'class' : 'SimpleStrategy', 'replication_factor' : {replication} }}")
But that was open to injection so I changed the code to
replication_string = f"{ { 'class' : 'SimpleStrategy', 'replication_factor' : {replication} }}" conn.execute("CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = %s", (db_name, replication_string))
This is now causing an error
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:30 no viable alternative at input 'juju_db_lma_cstress' (CREATE KEYSPACE IF NOT EXISTS ['juju_db_lma_cstres]...)">
Does anyone know why I'm getting this error? It looks like it should be the same to me.
Note: in this particular case "replication" is 1 and "db_name" is "juju_db_lma_cstress"