Skip to content

Commit ab3d3cc

Browse files
committed
update readme for questions
1 parent ada21fd commit ab3d3cc

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@ list(catalog)
2929
This will produce output like
3030

3131
```
32-
[table1, table2, table3]
32+
['first-db.table_a', 'first-db.table_b', 'questions.3']
3333
```
3434

3535
To load a table as a Pandas DataFrame
3636

3737
```
38-
df = catalog.<table>.read()
38+
df = catalog['<table>'].read()
3939
```
4040

4141
Replace `<table>` with the name of the table from the list.
4242

43+
This driver supports multiple databases and saved questions.
44+
4345
## Load a single table
4446
To load a table as a Pandas DataFrames you will need to know the following information
4547

@@ -66,12 +68,40 @@ ds = intake.open_metabase_table(domain, username, password,
6668
database, table)
6769
df = ds.read()
6870
```
71+
## Load a single question
72+
73+
To load a table as a Pandas DataFrames you will need to know the following information
74+
75+
* `domain`: The URL where Metabase is running
76+
* `username`: Your username, typically an email address
77+
* `password`: Your password (Google Auth is not yet supported)
78+
* `question`: The numeric id of the question
79+
80+
You can generally determine the numeric id of the question you are interested in by
81+
82+
1. Visit `<domain>/collection/root?type=card`
83+
1. Click on the question
84+
* You'll see in the url the question id `<domain>/question/<question_id>`
85+
86+
```python
87+
import intake
88+
ds = intake.open_metabase_question(domain, username, password,
89+
question)
90+
df = ds.read()
91+
```
92+
6993

7094
## Constructing catalogs
95+
This repository provides three drivers
96+
97+
* `metabase_catalog`: Catalog entry to retrieve all tables and questions
98+
* `metabase_table`: Catalog entry for a single table in a database
99+
* `metabase_question`: Catalog entry for a single saved question
71100

72101
To build a catalog containing a Metabase table it can be useful to use the
73102
[Catalog Templating](https://intake.readthedocs.io/en/latest/catalog.html#templating) features
74-
to avoid writing usernames and passwords into the catalog
103+
to avoid writing usernames and passwords into the catalog. For example this catalog
104+
provides a single table.
75105

76106
```yaml
77107
metadata:

0 commit comments

Comments
 (0)