cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

Python coding in notebook with a (long) token

phguk
New Contributor III

I have written a python program (called by a trigger) that uses a token issued by a third party app (it's circa 400 bytes long including '.' and '-'). When I copy/paste this token into a Databricks notebook - curious formatting takes place and a couple of line breaks appear to be inserted. I believe this formatting corrupts my token (and my program fails). In contrast, when I recreate the same program into a juypter notebook, along with a new pasted copy of the token - it appears as a single uninterrupted record (and my program works).

My suspicion is the Notebook GUI is trying to be clever (but in the case of my token - it's corrupted). What can I do to get the same behaviour as with Juypter ? I've seen mention of a Black python code formatter but I don't believe I'm using this - simply default Notebook. Alternatively - must I do something else to encapsulate the token so that its integrity is preserved ?

Thanks Paul

2 REPLIES 2

ashraf1395
Honored Contributor

Hey Paul, You can use databricks secrets for preserving the integrity of the token.

Here's the databricks doc for refernece : https://docs.databricks.com/aws/en/security/secrets

phguk
New Contributor III

Yes, that's a good suggestion, thanks.  However, I've spotted that even though notebook inserts what appears to be a new line after any '.' characters, my token string still only occupies one record (in the notebook). This leads me to think that it retains its fidelity (despite the quirky formatting). I'll include a pic of a long-dead token to show you what I mean.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now