[ 
https://issues.apache.org/jira/browse/CASSANDRA-14825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16934349#comment-16934349
 ] 

Robert Stupp commented on CASSANDRA-14825:
------------------------------------------

I've opened [a PR|https://github.com/apache/cassandra/pull/361] that implements 
the solution as a {{DESCRIBE}} statement. The syntax has been borrowed from 
what cqlsh implements.

{{DESCRIBE}} returns a result set with a single text column, the number or 
returned rows depends on the amount of data and the implementation. Callers 
just concatenate the contents of the single column of all rows to get the 
requested DDL script.
The paging implementation takes care of paging and ensures that the statement 
properly aborts when the schema has changed between two pages with an 
appropriate error message.
The implementation itself is ready to run even a {{DESCRIBE FULL SCHEMA WITH 
INTERNALS}} over a ton of keyspaces and tables.
cqlsh has been adopted as well.
A {{DESCRIBE ... WITH INTERNALS}} shows the internal things like table ID and 
emits a DDL script that re-creates dropped columns.
[All dtests|https://github.com/apache/cassandra-dtest/pull/53] checking the 
DESCRIBE output have been migrated into a new unit test (i.e. will be skipped 
except for a rudimentary test).

A 
[readme|https://github.com/snazy/cassandra/blob/14825-expose-schema-describe/doc/DESCRIBE.md]
 is present as well.

> Expose table schema for drivers
> -------------------------------
>
>                 Key: CASSANDRA-14825
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14825
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Legacy/CQL
>            Reporter: Chris Lohfink
>            Assignee: Chris Lohfink
>            Priority: Normal
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently the drivers recreate the CQL for the tables by putting together the 
> system table values. This is very difficult to keep up to date and buggy 
> enough that its only even supported in Java and Python drivers. Cassandra 
> already has some limited output available for snapshots that we could provide 
> in a virtual table or new query that the drivers can fetch. This can greatly 
> reduce the complexity of drivers while also reducing bugs like 
> CASSANDRA-14822 as the underlying schema and properties change.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to