Skip to content

Commit

Permalink
chore: fix sqlite doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 30, 2024
1 parent fb24d81 commit f17723e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ibis/backends/sqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ def do_connect(
Examples
--------
>>> import ibis
>>> ibis.sqlite.connect("path/to/my/sqlite.db")
>>> con = ibis.sqlite.connect()
>>> t = con.create_table("my_table", schema=ibis.schema(dict(x="int64")))
>>> con.insert("my_table", obj=[(1,), (2,), (3,)])
>>> t
DatabaseTable: my_table
x int64
>>> t.head(1).execute()
x
0 1
"""
_init_sqlite3()

Expand Down Expand Up @@ -417,11 +424,11 @@ def attach(self, name: str, path: str | Path) -> None:
Examples
--------
>>> con1 = ibis.sqlite.connect("original.db")
>>> con2 = ibis.sqlite.connect("new.db")
>>> con1.attach("new", "new.db")
>>> con1 = ibis.sqlite.connect("/tmp/original.db")
>>> con2 = ibis.sqlite.connect("/tmp/new.db")
>>> con1.attach("new", "/tmp/new.db")
>>> con1.list_tables(database="new")
[]
"""
with self.begin() as cur:
cur.execute(f"ATTACH DATABASE {str(path)!r} AS {_quote(name)}")
Expand Down

0 comments on commit f17723e

Please sign in to comment.