Skip to content

Commit

Permalink
docs: remove old-style schema construction from examples and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Sep 12, 2023
1 parent 5240af5 commit 1b1c33a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 33 deletions.
24 changes: 6 additions & 18 deletions docs/backends/impala.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ You can use the `create_table` method either on a database or client
object.

```python
schema = ibis.schema([('foo', 'string'),
('year', 'int32'),
('month', 'int16')])
schema = ibis.schema(dict(foo='string', year='int32', month='int16'))
name = 'new_table'
db.create_table(name, schema=schema)
```
Expand All @@ -316,9 +314,7 @@ You can force a particular path with the `location` option.

```python
from getpass import getuser
schema = ibis.schema([('foo', 'string'),
('year', 'int32'),
('month', 'int16')])
schema = ibis.schema(dict(foo='string', year='int32', month='int16'))
name = 'new_table'
location = '/home/{}/new-table-data'.format(getuser())
db.create_table(name, schema=schema, location=location)
Expand Down Expand Up @@ -353,9 +349,7 @@ To create an empty partitioned table, include a list of columns to be
used as the partition keys.

```python
schema = ibis.schema([('foo', 'string'),
('year', 'int32'),
('month', 'int16')])
schema = ibis.schema(dict(foo='string', year='int32', month='int16'))
name = 'new_table'
db.create_table(name, schema=schema, partition=['year', 'month'])
```
Expand Down Expand Up @@ -389,9 +383,7 @@ specific, you can either use a dict with the partition key names and
values, or pass a list of the partition values:

```python
schema = ibis.schema([('foo', 'string'),
('year', 'int32'),
('month', 'int16')])
schema = ibis.schema(dict(foo='string', year='int32', month='int16'))
name = 'new_table'
db.create_table(name, schema=schema, partition=['year', 'month'])

Expand Down Expand Up @@ -1028,12 +1020,8 @@ $ rm -rf csv-files/
The schema here is pretty simple (see `ibis.schema` for more):

```python
>>> schema = ibis.schema([('foo', 'string'),
... ('bar', 'double'),
... ('baz', 'int32')])

>>> table = con.delimited_file('/__ibis/ibis-testing-data/csv',
... schema)
>>> schema = ibis.schema(dict(foo='string', bar='double', baz='int32'))
>>> table = con.delimited_file('/__ibis/ibis-testing-data/csv', schema)
>>> table.limit(10)
foo bar baz
0 63IEbRheTh 0.679389 6
Expand Down
20 changes: 5 additions & 15 deletions ibis/backends/pandas/aggcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
::
>>> import ibis
>>> schema = [
... ('time', 'timestamp'), ('key', 'string'), ('value', 'double')
... ]
>>> schema = dict(time='timestamp', key='string', value='double')
>>> t = ibis.table(schema, name='t')
>>> t[t, t.value.sum().name('sum_value')].sum_value # quartodoc: +SKIP # doctest: +SKIP
Expand Down Expand Up @@ -76,9 +74,7 @@
::
>>> import ibis
>>> schema = [
... ('time', 'timestamp'), ('key', 'string'), ('value', 'double')
... ]
>>> schema = dict(time='timestamp', key='string', value='double')
>>> t = ibis.table(schema, name='t')
>>> t.value.sum().over(ibis.window(group_by=t.key)) # quartodoc: +SKIP # doctest: +SKIP
Expand Down Expand Up @@ -120,9 +116,7 @@
::
>>> import ibis
>>> schema = [
... ('time', 'timestamp'), ('key', 'string'), ('value', 'double')
... ]
>>> schema = dict(time='timestamp', key='string', value='double')
>>> t = ibis.table(schema, name='t')
>>> window = ibis.cumulative_window(order_by=t.time)
>>> t.value.sum().over(window) # quartodoc: +SKIP # doctest: +SKIP
Expand Down Expand Up @@ -160,9 +154,7 @@
::
>>> import ibis
>>> schema = [
... ('time', 'timestamp'), ('key', 'string'), ('value', 'double')
... ]
>>> schema = dict(time='timestamp', key='string', value='double')
>>> t = ibis.table(schema, name='t')
>>> window = ibis.trailing_window(3, order_by=t.time)
>>> t.value.sum().over(window) # quartodoc: +SKIP # doctest: +SKIP
Expand Down Expand Up @@ -206,9 +198,7 @@
::
>>> import ibis
>>> schema = [
... ('time', 'timestamp'), ('key', 'string'), ('value', 'double')
... ]
>>> schema = dict(time='timestamp', key='string', value='double')
>>> t = ibis.table(schema, name='t')
>>> window = ibis.trailing_window(2, order_by=t.time, group_by=t.key)
>>> t.value.sum().over(window) # quartodoc: +SKIP # doctest: +SKIP
Expand Down

0 comments on commit 1b1c33a

Please sign in to comment.