Skip to content

Commit b0104cf

Browse files
authored
Update docs with info about concurrent writes (#226)
* Update docs with info about concurrent writes * I think we need lower case here
1 parent d0d1095 commit b0104cf

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

docs/get_started.qmd

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ The first argument is the object to save (usually a data frame, but it can be an
5353
The name is basically equivalent to a file name; you'll use it when you later want to read the data from the pin.
5454
The only rule for a pin name is that it can't contain slashes.
5555

56+
After you've pinned an object, you can read it back with [](`~pins.boards.BaseBoard.pin_read`):
57+
58+
```{python}
59+
board.pin_read("mtcars")
60+
```
61+
62+
You don't need to supply the file type when reading data from a pin because pins automatically stores the file type in the [metadata](#metadata).
63+
64+
::: {.callout-note}
65+
If you are using the Posit Connect board [](`~pins.board_connect`), then you must specify your pin name as
66+
`"user_name/content_name"`. For example, `"hadley/sales-report"`.
67+
:::
68+
69+
## How and what to store as a pin
5670

5771
Above, we saved the data as a CSV, but you can choose another option depending on your goals:
5872

@@ -62,24 +76,15 @@ Above, we saved the data as a CSV, but you can choose another option depending o
6276
- `type = "joblib"` uses `joblib.dump()` to create a binary Python data file, such as for storing a trained model. See the [joblib docs](https://joblib.readthedocs.io/en/latest/) for more information.
6377
- `type = "json"` uses `json.dump()` to create a JSON file. Pretty much every programming language can read JSON files, but they only work well for nested lists.
6478

65-
After you've pinned an object, you can read it back with [](`~pins.boards.BaseBoard.pin_read`):
66-
67-
```{python}
68-
board.pin_read("mtcars")
69-
```
70-
71-
You don't need to supply the file type when reading data from a pin because pins automatically stores the file type in the metadata, the topic of the next section.
72-
7379
Note that when the data lives elsewhere, pins takes care of downloading and caching so that it's only re-downloaded when needed.
7480
That said, most boards transmit pins over HTTP, and this is going to be slow and possibly unreliable for very large pins.
7581
As a general rule of thumb, we don't recommend using pins with files over 500 MB.
7682
If you find yourself routinely pinning data larger that this, you might need to reconsider your data engineering pipeline.
7783

78-
::: {.callout-note}
79-
If you are using the Posit Connect board [](`~pins.board_connect`), then you must specify your pin name as
80-
`"user_name/content_name"`. For example, `"hadley/sales-report"`.
81-
:::
84+
Storing your data/object as a pin works well when you write from a single source or process. It is _not_ appropriate when multiple sources or processes need to write to the same pin; since the pins package reads and writes files, it cannot manage concurrent writes.
8285

86+
- **Good** use for pins: an ETL pipeline that stores a model or summarized dataset once a day
87+
- **Bad** use for pins: a Shiny app that collects data from users, who may be using the app at the same time
8388

8489
## Metadata
8590

0 commit comments

Comments
 (0)