scylladb / gocql

Package gocql implements a fast and robust ScyllaDB client for the Go programming language.
https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-go-driver.html
BSD 3-Clause "New" or "Revised" License
169 stars 47 forks source link

RFE: make ToCQL use server side DESCRIBE SCHEMA #195

Open Michal-Leszczynski opened 3 weeks ago

Michal-Leszczynski commented 3 weeks ago

Method func (km *KeyspaceMetadata) ToCQL() (string, error) is doing basically the same thing as DESC SCHEMA query, but on the driver side. There is no need to do it on both server and driver side, especially that driver will be always lagging behind scylla releases. For example, the server side DESCRIBE SCHEMA WITH INTERNALS is already printing CQL statements about dropped and re-added columns (this is important feature in terms of using those CQL schema for restore purposes), but it is missing from the driver method.

IMO this method should be deprecated or rewritten to use the server side DESC SCHEMA so that it is safer and easier to maintain.

mykaul commented 1 week ago

Will it work against all supported versions of Scylla? What about Cassandra?

mykaul commented 1 week ago

Will it work against all supported versions of Scylla? What about Cassandra?

@dkropachev?

dkropachev commented 1 week ago

@mykaul , greate question, i will give it a test and update you, one of the options we have is to fallback to old logic (logic we currently have) if DESCRIBE SCHEMA WITH INTERNALS is not available

dkropachev commented 6 days ago

@mykaul , greate question, i will give it a test and update you, one of the options we have is to fallback to old logic (logic we currently have) if DESCRIBE SCHEMA WITH INTERNALS is not available

It won't but we can fallback to old behavior, added logic to handle it to the PR