-
Notifications
You must be signed in to change notification settings - Fork 0
Home
========================
A python wrapper for Metabase API All the function terminology is the same as the Metabase Documentation is using for example :
if Metabase API dashboard has a GET API request then Metabase Client wrapper class also using the same function name as dashboard().get() to call for more read the wiKi Below.
Index
- Installation
- Usage
- Addon's
Installation
pip install MetabaseClient
Usage
-
import py package
import MetabaseClient as MC
-
init client
client = MC.Client()
client.authenticate(url,username,password)
or
client = MC.Client(url,username,password)
or
client = MC.Client(url,token)
-
Stored Queries or Cards
client.card().get()
or
# get(card_id)
client.card().get(555)
-
Stored dashboard
client.dashboard().get()
or
# get(card_id)
client.dashboard().get(555)
-
Get Utils
Note Utils Function Required Admin Access
client.utils()
client.utils().bug_report_details()
client.utils().logs()
client.utils().random_token()
client.utils().stats()
client.utils().password_check(password)
Metabase Addon's
Metabase Addon's are special function written using core Metabase API.
-
import py package
from MetabaseClient.Addon import SearchCard
search = SearchCard(url = 'url',username = 'email',password = 'pass')
-
SearchCard Features
-
Keyword Search: This allows its user to search storied SQL queries containing parameter keyword.
Search Algo: Simple for loop search with find() from str class function
Usange:
search.search_by_keyword('st_intersect')
-
Email/Creator Search: This allows its user to search storied SQL queries' creator by parameter email id.
Search Algo: Simple for loop search with find() from str class function
Usange:
search.search_by_email('rahulrathi@xyz.com')
-
Title Search: This allows its user to search storied SQL queries' title by containing the passed parameter keyword.
Search Algo: Simple for loop search with find() from str class function
Usange:
search.search_by_name('revenue')
-
function Search: This allows its user to search storied SQL queries' by custom search parameter function.
Search Algo: As per applied function.
Usange:
`# define a function which take query as input parameter` `def cust_fun(query):` `# write function definition ` `# return true if you want that query in final results` `if len(query) < 10 : # condition defination` `return True # return true to append query in output result` `else :` `return False # return false` `search.search_by_function(cust_fun)`
-
Regex Search: This allows its user to search storied SQL queries' by parameter re.search.
Search Algo: Python re.search Usange: `search.search_by_regex('A-z')`
-
-
FindCard Features
FindCard allows its user to find SQL queries by passing a SQL query. for example we need to find a name, creator for a SQL query but we don't have Metabase query creator, card id, name, etc but we have the query this feature allow you to find possible match query by using nltk's word_tokenize, probability functions.
Search Algo: using nltk word_tokenize, probability cross-checks with all storied SQL queries in Metabase.
Usage:
cooning soon
-
Migrate Features
Migrate Feature allow its user to migrate already storied Metabase query to new Metabase query. You also use it to sync two Metabase instances for storied queries.
Search Algo: using get method on old/instance-1 and applying post method on new/instance-2
Usage:
cooning soon