Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertDeFusco committed Feb 8, 2021
1 parent 187e324 commit cb17d80
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 14 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# intake_metabase

Intake driver to load [Metabase tables](https://www.metabase.com/)

## Quickstart

To load a table as a Pandas DataFrames you will need to know the following information

* `domain`: The URL where Metabase is running
* `username`: Your username, typically an email address
* `password`: Your password (Google Auth is not yet supported)
* `database`: The numeric id of the database where the table is stored
* `table`: The numeric id of the table to load

You can generally determine the numeric ids of the database and table from the URL when you are viewing the table in your browser. Here are the steps.

1. Visit `<domain>/reference`
1. Click on the database you want
1. You'll now see that the url has changed to `<domain>/reference/databases/<database>` where `database` is the numeric id of the database.
1. Click on `Tables in <database-name>`
1. Click on your desired table
1. You'll now see that the url has changed to `<domain>/reference/databases/<database>/tables/<table>` where `table` is the numeric id of the table.

Once you have all of the above information you can load a table as follows

```python
import intake
ds = intake.open_metabase_table(domain, username, password,
database, table)
df = ds.read()
```

## Constructing catalogs

To build a catalog containing a Metabase table it can be useful to use the
[Catalog Templating](https://intake.readthedocs.io/en/latest/catalog.html#templating) features
to avoid writing usernames and passwords into the catalog

```yaml
metadata:
version: 1

sources:
my_table:
description: My table
driver: metabase_table
args:
domain: <domain>
username: 'env("METABASE_USERNAME")'
password: 'env("METABASE_PASSWORD")'
database: 2
table: 6
```
14 changes: 0 additions & 14 deletions README.rst

This file was deleted.

5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from setuptools import setup
import versioneer

with open("README.md", "r") as fh:
long_description = fh.read()

requirements = [
"intake",
"pandas",
Expand All @@ -12,6 +15,8 @@
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Metabase driver for Intake",
long_description=long_description,
long_description_content_type='text/markdown',
license="BSD",
author="Albert DeFusco",
author_email='[email protected]',
Expand Down

0 comments on commit cb17d80

Please sign in to comment.