@vinay kumarโ :
Yes, you can define custom session variables for login user authentication in Databricks. These session variables can be used to implement row-level and column-level security, similar to what you described for HANA.
To define custom session variables in Databricks, you can use the Databricks REST API or Databricks CLI. Here's an example using the Databricks CLI:
- Install the Databricks CLI on your local machine
- Open a terminal window and authenticate to your Databricks workspace using the databricks configure command
- Run the following command to set a custom session variable:
databricks workspace set-user-session "user1" "key1" "value1"
This command sets the custom session variable key1 with a value of value1 for the user user1 You can set multiple custom session variables for a user by running this command multiple times with different key-value pairs.
Once you have set the custom session variables for the user, you can access them in your Databricks notebooks or jobs using the dbutils.entry_point.getDbutils().notebook().getContext().tags() method. This method returns a dictionary containing the custom session variables for the current user.
For example, you can access the value of the key1 custom session variable using the following code:
key1_value = dbutils.entry_point.getDbutils().notebook().getContext().tags().get("key1")
You can then use the value of key1_value to implement row-level and column-level security in your Databricks notebooks or jobs.