Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosasko committed Oct 7, 2022
1 parent 034bf18 commit c7a1961
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/source/loading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,19 @@ For example, a table from a SQLite file can be loaded with:
Use a query for a more precise read:

```py
>>> from sqlite3 import connect
>>> con = connect(":memory")
>>> # db writes ...
>>> from datasets import Dataset
>>> dataset = Dataset.from_sql("SELECT text FROM data_table WHERE length(text) > 100 LIMIT 10", "sqlite:///sqlite_file.db")
>>> dataset = Dataset.from_sql("SELECT text FROM table WHERE length(text) > 100 LIMIT 10", con)
```

<Tip>

To cache the read, specify [`Dataset.from_sql#con`] as a [URI string](https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls).

</Tip>

## In-memory data

馃 Datasets will also allow you to create a [`Dataset`] directly from in-memory data structures like Python dictionaries and Pandas DataFrames.
Expand Down

0 comments on commit c7a1961

Please sign in to comment.