Skip to content

Commit

Permalink
docs: show interactive prompt for python
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Nov 2, 2022
1 parent 1fd66cf commit 5d7d913
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,26 @@ Here’s an example of how to use Ibis with an SQLite database.

Download the SQLite database from the ibis-tutorial-data GCS (Google Cloud Storage) bucket, then connect to it using ibis.

```python
import ibis
ibis.options.interactive = True

#make a directory called geo_dir and add the geography database top that folder

!mkdir geo_dir
!curl -LsS -o 'geo_dir/geography.db' 'https://storage.googleapis.com/ibis-tutorial-data/geography.db'
```bash
# make a directory called geo_dir and add the geography database to that folder
mkdir -p geo_dir
curl -LsS -o geo_dir/geography.db 'https://storage.googleapis.com/ibis-tutorial-data/geography.db'
```

#connect to the database and list the tables in it
Connect to the the database and show the available tables

connection = ibis.sqlite.connect('geo_dir/geography.db')
connection.list_tables()
```python
>>> import ibis
>>> ibis.options.interactive = True
>>> connection = ibis.sqlite.connect('geo_dir/geography.db')
>>> connection.list_tables()
['countries', 'gdp', 'independence']
```

#connect choose the countries table and preview it’s first few rows
Choose the `countries` table and preview its first few rows

countries = connection.table('countries')
```python
>>> countries = connection.table('countries')
countries.head()
```

Expand Down

0 comments on commit 5d7d913

Please sign in to comment.