-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Create a table like this with spanner-cli:
create table aliases (
id string(max),
foo string(max),
last_commit_ts timestamp options (allow_commit_timestamp=true)
) primary key (id);Insert the metadata:
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'aliases', 'id', 'text', true, 0);
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'aliases', 'foo', 'text', false, 0);Insert a test record:
insert into aliases (id, foo) values ('a', 'b');Query with an alias works in spanner-cli:
select id, foo as bar from aliases;Try to query with an alias from cqlsh:
select id, foo as bar from test.aliases;cqlsh shows this error:
InvalidRequest: Error from server: code=2200 [Invalid query] message="could not find column(bar) metadata. Please insert all the table and column information into the config table"
Proxy shows this error:
{"level":"error","time":"2024-10-23T00:13:34.603Z","caller":"proxy/proxy.go:1507","msg":"Error occurred at spanner - ","Query":"select id, foo as bar from test.aliases;","error":"could not find column(bar) metadata. Please insert all the table and column information into the config table","stacktrace":"github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).handleQuery\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:1507\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).Receive\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:641\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxycore.(*Conn).read\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxycore/conn.go:114"}
Insert the alias into the metadata:
INSERT INTO TableConfigurations (KeySpaceName, TableName, ColumnName, ColumnType, IsPrimaryKey, PK_Precedence) VALUES ('test', 'aliases', 'bar', 'text', false, 0);Restart the proxy.
Now querying with an alias from cqlsh works.
Metadata
Metadata
Assignees
Labels
No labels