![]() create ( name = "Gmail Users", description = "Number of users with a email address.", table_id = 2, definition = Query ( table_id = 1, aggregations =, filters = ). from metabase import Metric, Query, Count, EndsWith, CaseOption metric = Metric. This can also be used to more easily create Metric objects. create ( database = 1, type = "query", query = from metabase import Dataset, Query, Count, GroupBy, TemporalOption dataset = Dataset. Metabase Query Language) from Python classes included in this package. You can also execute queries and get results back as a Pandas DataFrame. id, using = metabase, ) Querying & MBQL list (): # add all users to my_group PermissionMembership. create ( name = "My Group", using = metabase ) for user in User. Here's a slightly more advanced example: from metabase import User, PermissionGroup, PermissionMembership # create a new PermissionGroup my_group = PermissionGroup. send_invite () # Resend the user invite email for a given user. Some endpoints also support additional methods: from metabase import User user = User. delete() are available on allĮndpoints that support them in Metabase API. create ( using = metabase, first_name = "", last_name = "", email = "", password = "" ) delete () # create an object new_user = User. update ( is_superuser = True ) # delete an object user. is_active : print ( "User is active!" ) # update any available attribute user. get ( 1, using = metabase ) # attributes are automatically loaded and available in the instance if user. list ( using = metabase ) # get an object by ID user = User. from metabase import User # get all objects users = User. ![]() All changes are reflected in Metabase instantly. Instantiate an object from the Metabase API require the using parameter which expects an instance of Metabase suchĪs the one we just instantiated above. You can then interact with any of the supported endpoints through the classes included in this package. from metabase import Metabase metabase = Metabase ( host = "", user = "", password = "", ) Interacting with Endpoints Start by creating an instance of Metabase with your credentials. An unofficial Python library for the Metabase API.
0 Comments
Leave a Reply. |