cloudspannerecosystem / cassandra-to-spanner-proxy

Apache License 2.0
9 stars 4 forks source link

Cannot use USE #21

Open jdiamond opened 1 week ago

jdiamond commented 1 week ago

The proxy does not seem to use keyspaces set with USE.

One of our applications is using Spring Data for Cassandra and it is using USE before executing any queries. All subsequent queries don't reference the keyspace and are failing. Our other applications don't use Spring Data so this hasn't been a problem until now.

I can reproduce it with cqlsh and think it might be an issue with the proxy.

Create a table in Spanner or use an existing one. It doesn't need any data to see the error.

create table data (
  id string(max)
) primary key (id);

Add the metadata if you need it:

INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'data', 'id', 'text', true, 0);

Try to query from this table without the keyspace in cqlsh:

SELECT * FROM data;

Of course that fails with this error message:

InvalidRequest: Error from server: code=2200 [Invalid query] message="could not find table or keyspace name"

But it works when you include the keyspace:

SELECT * FROM test.data;

Try to use the USE keyword then query without the keyspace:

USE test;
SELECT * FROM data;

And the same error as up above appears.

mayurkale22 commented 1 week ago

Thank you for reporting this issue, @jdiamond. At this time, the USE keyword is not supported with proxy. Please let us know how this impacts your workflow. Do you have a workaround, or is this a significant obstacle for your applications? This information will assist us in prioritizing this task.

mayurkale22 commented 1 week ago

/CC @ShuranZhang

jdiamond commented 1 week ago

I have not found a way to control this behavior in Spring Data for Cassandra so we don't currently have a workaround.

mayurkale22 commented 6 days ago

This should be fixed in https://github.com/cloudspannerecosystem/cassandra-to-spanner-proxy/pull/22

mayurkale22 commented 1 day ago

Hi @jdiamond, I have submitted the fix (#22), could you pls use the main branch and verify the fix?