You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/get_started.qmd
+17-12Lines changed: 17 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,20 @@ The first argument is the object to save (usually a data frame, but it can be an
53
53
The name is basically equivalent to a file name; you'll use it when you later want to read the data from the pin.
54
54
The only rule for a pin name is that it can't contain slashes.
55
55
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
56
70
57
71
Above, we saved the data as a CSV, but you can choose another option depending on your goals:
58
72
@@ -62,24 +76,15 @@ Above, we saved the data as a CSV, but you can choose another option depending o
62
76
-`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.
63
77
-`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.
64
78
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
-
73
79
Note that when the data lives elsewhere, pins takes care of downloading and caching so that it's only re-downloaded when needed.
74
80
That said, most boards transmit pins over HTTP, and this is going to be slow and possibly unreliable for very large pins.
75
81
As a general rule of thumb, we don't recommend using pins with files over 500 MB.
76
82
If you find yourself routinely pinning data larger that this, you might need to reconsider your data engineering pipeline.
77
83
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.
82
85
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
0 commit comments