I'm currently utilizing the datastax nodejs-driver to retrieve information about a keyspace from cassandra.
const results = await client.execute( `
DESC KEYSPACE ${keyspace}
` );
The method client.execute
provides a comprehensive object containing various details:
ResultSet {
info: {
queriedHost: '127.0.0.1:9042',
triedHosts: { '127.0.0.1:9042': null },
speculativeExecutions: 0,
achievedConsistency: 10,
traceId: undefined,
warnings: undefined,
customPayload: undefined,
isSchemaInAgreement: true
},
rows: [
Row {
keyspace_name: 'xxxx',
type: 'keyspace',
name: 'xxxx',
create_statement: "CREATE KEYSPACE xxxx WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;"
}
],
rowLength: 1,
columns: [
{ name: 'keyspace_name', type: [Object] },
{ name: 'type', type: [Object] },
{ name: 'name', type: [Object] },
{ name: 'create_statement', type: [Object] }
],
pageState: null,
nextPage: undefined,
nextPageAsync: undefined
}
However, when executing DESC KEYSPACE xxxx
, only the create_statement
section is returned:
cqlsh> DESC xxxx;
CREATE KEYSPACE xxxx WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;
cqlsh>
Here are my inquiries:
- Why does the client driver not provide more detailed information in the results?
- Is it possible to obtain the same outcomes using cqlsh?
- The result above features a property called
Row
, resembling this structure:
interface Row {
keyspace_name: string;
type: 'keyspace';
name: string;
create_statement: string;
}
Where can I access the definitions of different types of Row
s?
Thank you for your assistance.