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\sql-endpoint UI, but the challenge is to run it from a junyper notebook.

  • 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. 

4 Replies

  • v-priyankata's avatar
    v-priyankata
    Community Support

    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. 

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi yllsuarez76 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

     

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi yllsuarez76 
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi yllsuarez76 
    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.