How to generate the query to clone an existing table - cassandra

I use the community edition of Cassandra (not DSE). Earlier I used to use a tool called descanter. when I click "clone" in descanter on an existing table. it used to give me the CQL necessary to re-create the existing table.
Now on my new MacOS (High Sierra) the devcenter tool is broken. I searched on the forums and found that DataStax has no intention of maintaining the tool.
So I am now using the command line CQLSH. Now in CQLSH if I have an existing table. How to generate the query to clone an existing table?
I only need the table structure. I don't need any data.
I cannot physically login to the Cassandra server. So everything needs to be done by connecting to Cassandra remotely using CQLSH.

DESCRIBE command should help you

Related

How can I apply a schema.cql to a new DataStax Astra database keyspace?

I've got an existing Cassandra application I want to try in Datastax Astra. I've created my Astra database and am able to connect to it from NodeJS successfully. The next task I have is to apply my existing schema.cql to the keyspace.
It should be easy enough right? But never-the-less I can't see any obvious way to do this. Can someone walk me through it please. I can then I think use the dsbulk tool to upload a dataset.
Thanks in advance Astra experts.
Rod
The easiest way to do it is to cut-and-paste the CQL statements one-by-one into the CQL console and run them one at a time. This is what I would recommend since you have guarantees that each DDL statement has completed successfully before you can execute the next one.
Alternatively, you can download the Standalone CQL Shell to your laptop/desktop and run the cqlsh commands from there. You will need to configure it with your app token + secure connect bundle to be able to connect to your database.
For more info, see the instructions for Installing standalone cqlsh. Cheers!
Converting comment to answer:
Unauthorized('Error from server: code=2100 [Unauthorized]
message="No SELECT permission on <table system_virtual_schema.keyspaces>
What is the role you have created your token for in Astra DB? Otherwise, create a new one as "Database Administrator" and that should be able to SELECT FROM system_virtual_schema.keyspaces.
While creating use-specific roles is a good idea, only privileged roles can run data definition language (DDL) commands.

Unable to write on hive on HDP2.4.0.0-169 sandbox when running scala application job from eclipse

I am facing a weird issue which working with HDP2.4.0.0-169 sandbox.
I have HDP with host name - sandbox.hortonworks.com and ip 192.168.159.129, I have all default hadoop and other services up and running on that.
I have written a spark code for creating a table in hive and reading the content any existing table of hive present on HDP. I also have a code for writing data/inserting data into newly created hive table.
As soon as I run this code from my Eclipse using run as Scala Application option, it creates the table. It also reads the table but it is not able to write anything in any new or existing table created. This seems to be very weird to me as I can create table but can not write anything in it.
It gives me following error
Exception while executing hive query.java.net.UnknownHostException:
sandbox.hortonworks.com
I have an entry for sandbox.hortonworks.com in my windows hosts file
as well but unable to figure out why it is not allowing me to write
any data in hive table when I can create a table?
Is there any user's read/write permission issue?
If yes, then why it is allowing me to create and read data from hive using same user from eclipse?
It is only not allowing me to insert data into those hive tables.
Any quick pointer/reference would be appreciated.
Regards,
Bhupesh
Got it.
By mistake the entry made in C:\Windows\System32\drivers\etc\hosts file was wrong.
It should be
192.168.159.129 sandbox.hortonworks.com

Connecting open-source Cassandra to Tableau Desktop

I am trying to use the Business Intelligence (BI) software Tableau Desktop to see into a local Cassandra cluster. The Cassandra cluster is the open-source version and not the proprietary version that one pays to use. The version of Cassandra I am using is 2.2.x.
I can successfully connect Cassandra and Tableau after configuring the 64 bit ODBC driver. However, actually querying the tables in the NoSQL database throws errors. For instance in the 'Data Source' view selecting 'Update Now' results in an error from a SQL statement that starts with SELECT 1... I do not think Cassandra can understand, process, SELECT 1 statements.
Errors are also thrown when trying to build graphs of the data as this also results in failed queries.
In the 'Advanced Options' for the ODBC driver I selected to use CQL as the 'Query Mode' and still there were problems with the queries Tableau was sending to Cassandra.
Does anyone know how to get these two technologies to work together? I found this tutorial but it was made almost a year ago, as of this writing, and does not work from my experience. Please see the link to what I am talking about here: http://www.datastax.com/dev/blog/datastax-odbc-cql-connector-apache-cassandra-datastax-enterprise In this article they say to download the driver from here: https://academy.datastax.com/downloads/download-drivers?dxt=DX I am wondering this specific version of the ODBC driver is the problem.
I also read a previous post on this and it was not helpful as it is also obsolete from my experience. The post I am referring to is at the following URL: Connecting cassandra to Tableau Software The first answer is probably the obsolete one but the second one recommends to use the Simba driver, which is some type of proprietary driver. My current hypotheses is maybe the Simba driver is needed to use Tableau and Cassandra together.
Thank-you for reading this.
DataStax licenses Simba Technologies ODBC driver, but the version on their website may be behind the latest version available from Simba. Please download a free evaluation version of the driver and see if you have the same issue: http://www.simba.com/drivers/cassandra-odbc-jdbc/
'SELECT 1' is not a valid CQL query (http://docs.datastax.com/en/cql/3.1/cql/cql_reference/select_r.html).

Change Capture from DB2 to Cassandra

I am trying to get all inserts, updates, deletes to a normalized DB2 database (hosted on an IBM Mainframe) synced to a Cassandra database. I also need to denormalize these changes before I write them to Cassandra so that the data structure meets my Cassandra model.
Searched on google but tools either lack processing support or streaming CDC support.
Is there any tool out there that can help me achieve the above?
It's likely that no stock tool exists. What's the format of the CDC stream coming out? What queries do you need to run? Like any other Cassandra data modeling question, start with the queries you need to run and work backwards to the table structure(s).

In Cassandra database the Table created in CQL is not seen in CLI?

In Cassandra database the Table created in CQL is not seen in CLI in same column family is there any reference reason for the same ?
This is because two diffrent protocols are used to create the column family. You are creating the 'table' using the CQL binary protocol and then you are trying to edit it using the THRIFT interface (through CLI), this is not allowed on purpose. From the Cassandra CTO:
This is by design. CLI and Thrift-based consumers in general do not know how to understand CQL3 metadata, and would do the Wrong Thing without realizing it.
You can find the documented "issue" here.
If you wanted to access the data in the table you created you can use cqlsh.

Resources