cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Discussions
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to override a in-built function in databricks

Jerry01
New Contributor III

I am trying to override is_member() in-built function in such a way that, it always return true. How to do it in databricks using sql or python?

1 REPLY 1

Kaniz
Community Manager
Community Manager

Hi @Jerry01To override the is_member() built-in function in Databricks so that it always returns true, you can follow these steps:

  1. Python Approach:

    • Unfortunately, Databricks does not directly allow you to override built-in functions like is_member(). However, you can create a custom Python function that mimics the behavior you want.
    • Define a Python function that always returns True when called.
    • For example:
      def my_custom_is_member(group_name):
          return True
      
    • Use this custom function in your code instead of the built-in is_member().
  2. SQL Approach:

Remember that overriding built-in functions should be done carefully, as it can have unintended consequences. Ensure that your custom implementation aligns with your specific requirements and doesnโ€™t break existing functionality.

 
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.