Skip to main content

metabase api python client

Project description

Copyright (c) 2016 - iyzico odeme hizmetleri A.S. (https://iyzico.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



Description:
### metabasepy

Python wrapper for metabase rest api



#### Export All Questions ( cards )


```
from metabasepy.client import Client, AuthorizationFailedException

metabase_client_config = {
'username': 'foo',
'password': 'bar',
'base_url': 'http://localhost:3000'
}

cli = Client(**metabase_client_config)
try:
cli.authenticate()
except AuthorizationFailedException as ex:
# checkout your configurations
raise

all_cards = cli.cards.get()

for card_info in all_cards:
card_name = card_info.get('name', "Question")
sql_query = card_info['dataset_query']['native']['query']

print(card_name)
print(sql_query)

```


Get Card Data

```

from metabasepy import Client, MetabaseTableParser

metabase_client_config = {
'username': 'foo',
'password': 'bar',
'base_url': 'http://localhost:3000'
}
cli = Client(**metabase_client_config)

query_result = cli.cards.query(card_id=1)

data_table = MetabaseTableParser.get_table(query_result)

for col in data_table.columns:
print col


for line in data_table.rows:
print line

```

Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metabasepy-1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file metabasepy-1.0-py3-none-any.whl.

File metadata

  • Download URL: metabasepy-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.4

File hashes

Hashes for metabasepy-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16e178bc2ce74bc9f14f49f5a6d71b8a7874845ac4741b6bd9b920b26d8003c2
MD5 1820c32a645f6d154b8c14e2bb6ef4d4
BLAKE2b-256 06ba82eac5dba06db74dab1a62696851bc86ecb072a3f768e11e544f3222dc67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page