Forum Discussion

yllsuarez76's avatar
yllsuarez76
Microsoft Employee
1 year ago
Solved

How to write to a SQL endpoint from Notebook

I need to grant access (via code) to a Table in an specific schema for an Entra Security Group accesing a lakehouse using SQL endpoint.   I can run a sql query using GRANT statement in lakehouse\sq...
  • v-priyankata's avatar
    1 year ago

    Hi yllsuarez76  ,

    You can execute a GRANT statement on a Fabric Lakehouse SQL Endpoint from a notebook by connecting to the endpoint using an ODBC connection. This allows you to run SQL commands, including permission-related queries, from your notebook.

    Here’s how you can approach it:

    • Use a supported ODBC driver to connect to the SQL endpoint.
    • Establish a connection using valid authentication (such as a service principal or managed identity).
    • Execute the GRANT statement within the notebook to assign the necessary permissions.
    • Ensure that the user or security group has the appropriate privileges to modify permissions.

    If this helps, then please Accept it as a solution and dropping a "Kudos" so other members can find it more easily.

    Thank you.