I am trying to add new columns dynamically from Spring Boot application. Let us say, each time an event e occurs, I want to add a column into a Cassandra table with a well defined column-name and type. I have tried this code:

```
    @Query("alter table attributes.attributedata add ?0 ?1")
    public void addColumn(String columnName, String dataType);

```

Error Log:

```
    org.springframework.cassandra.support.exception.CassandraQuerySyntaxException: line 1:41 no viable alternative at input 'gac5' (alter table attributes.attributedata add ['gac]...); nested exception is com.datastax.driver.core.exceptions.SyntaxError: line 1:41 no viable alternative at input 'gac5' (alter table attributes.attributedata add ['gac]...)
    at org.springframework.cassandra.support.CassandraExceptionTranslator.translateExceptionIfPossible(CassandraExceptionTranslator.java:132)
    at org.springframework.cassandra.core.CqlTemplate.potentiallyConvertRuntimeException(CqlTemplate.java:946)
    at org.springframework.cassandra.core.CqlTemplate.translateExceptionIfPossible(CqlTemplate.java:930)
    at org.springframework.cassandra.core.CqlTemplate.translateExceptionIfPossible(CqlTemplate.java:912)
    at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:278)
    at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:559)
    at org.springframework.cassandra.core.CqlTemplate.doExecute(CqlTemplate.java:549)
    at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:485)
    at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:510)
    at org.springframework.cassandra.core.CqlTemplate.query(CqlTemplate.java:505)
    at org.springframework.data.cassandra.core.CassandraTemplate.selectOne(CassandraTemplate.java:638)
    at org.springframework.data.cassandra.core.CassandraTemplate.selectOne(CassandraTemplate.java:509)
    at org.springframework.data.cassandra.repository.query.CassandraQueryExecution$SingleEntityExecution.execute(CassandraQueryExecution.java:104)
    at org.springframework.data.cassandra.repository.query.CassandraQueryExecution$ResultProcessingExecution.execute(CassandraQueryExecution.java:143)
    at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:113)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:483)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)

```

I have also tried to store the entire query into a string and then directly place the string into value such that
`@Query(value="?0")`
but that does not work either.

This code works perfectly fine. If the values obtained from the function are not enclosed within single inverted commas, the code would work.

```
    @Query("alter table attributes.attributedata add dummy text")
    public void addColumn(String columnName, String dataType);

```

Is there any way this could work? Please suggest the possible alternatives.