question

Ryan Quey avatar image
Ryan Quey asked Ryan Quey commented

How can I connect to an Astra DB instance from notebooks or DB tools?

I have found tutorials on how to connect to Astra via http API or on a server through DataStax drivers via `withCloudSecureConnectBundle`. However, I am having a hard time figuring out how to connect via notebooks such as the Databricks Spark notebook or via database tools such as DBeaver. In these cases, can you still use your downloaded database credentials somehow? Is there a way to authenticate into Astra without your downloaded database credentials file? Or if not, what is the best way to access that file in such tools?

astranotebooks
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered Ryan Quey edited

@quey.ryan_189833 There is an embedded DataStax Studio with each Astra DB instance that allows you to create or import notebooks.

You can unpack the secure bundle for your Astra database to get the certificates that you can use to configure the SSL settings in DBeaver. I haven't tested it myself and isn't supported out-of-the-box so I'm unable to provide instructions on how to do it.

If you do go down the path of connecting with DBeaver, you will see these files when you unzip your secure bundle:

  • ca.crt - CA certificate
  • cert - user certificate
  • cert.pfx
  • config.json - contains metadata about bundle files
  • cqlshrc - contains connection hostname & connection port
  • identity.jks
  • key - user key
  • trustStore.jks - client truststore

TIP - Use the CQL port in cqlshrc for your connection settings. Cheers!

4 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Ryan Quey avatar image Ryan Quey commented ·

Great, thanks this is very helpful for getting me on the right path. So as far as you know, are there other DB tools (apart from DBeaver) that is officially supported to use with DataStax Astra?


And is it possible to connect an external notebook with Astra (for example, Databricks)?

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ Ryan Quey commented ·

At this point, only DataStax Studio. And you can import other notebooks into Studio but you won't be able to connect other notebooks unless you can figure out a way of configuring SSL using the certificates in the secure bundle. Cheers!

1 Like 1 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ Ryan Quey commented ·

I never managed to circle back to this but did you manage to get it working? I'm very keen to know the details. Cheers!

0 Likes 0 ·
Ryan Quey avatar image Ryan Quey Erick Ramirez ♦♦ commented ·

I needed a solution that could connect to Databricks, so since it seemed like it was not officially supported and I didn't have a tutorial to follow I decided to go a different route. At the time I was just getting started with Cassandra and Spark as is, so was trying to avoid doing anything too complicated or out of the norm.

After seeing Alex's comment though I would be interested to try again, for the reason he listed in the blog though, just something that you can do using free tiers and still have live in the cloud.

Hopefully will get some more time in the future to play around with it :) Thanks

0 Likes 0 ·
smadhavan avatar image
smadhavan answered Ryan Quey commented

@Ryan Quey, you can connect to DataStax Astra using Spark Cassandra Connector from external BYOS solutions such as a Databricks cluster or Microsoft Azure Data Factory notebooks. Refer to the below documentation,

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

alex.ott avatar image alex.ott commented ·

SCC 2.5.0 had a problem with dependencies on the Databricks, so connector itself couldn't work out of box, without preparing assembly. This is fixed in SCC 2.5.1...


and here is step-by-step writeup on how to access Astra from Databricks: https://alexott.blogspot.com/2020/07/working-with-datastax-astra-from.html

2 Likes 2 ·
Ryan Quey avatar image Ryan Quey alex.ott commented ·

Great blog post, will give it a try when I have a chance! Thanks

0 Likes 0 ·