Skill Tracer
Skills › Scientific Agent Skills › datalad › data-access.md

data-access.md

180 lines · skills/datalad/references/data-access.md at 5f2bc03

Open on GitHub
1# Finding, retrieving, and releasing dataset content
2

Finding, retrieving, and releasing dataset content

Raw lines 1 to 2
3## Finding published datasets
4
5| Source | What it holds | How to reach it |
6|---|---|---|
7| [registry.datalad.org](https://registry.datalad.org) | Search across discovered DataLad and git-annex datasets, indexing URL, dataset ID, branches, tags, and metadata | Search box supports a bare word, a quoted phrase, `AND`/`OR`/`NOT`, and field-specific terms; results give clone URLs |
8| [datasets.datalad.org](https://datasets.datalad.org) | The DataLad superdataset, a nested collection of curated public datasets | `datalad clone ///` for the superdataset, `datalad clone ///<name>` for one entry |
9| [OpenNeuroDatasets](https://github.com/OpenNeuroDatasets) | Public BIDS neuroimaging datasets from OpenNeuro, one repository per accession | `datalad clone https://github.com/OpenNeuroDatasets/ds00XXXX.git` |
10| [dandisets](https://github.com/dandisets) | DANDI archive dandisets, mostly neurophysiology in NWB | `datalad clone https://github.com/dandisets/000XXX.git` |
12The `///` shortcut is a DataLad resource identifier that resolves to the superdataset on
13`datasets.datalad.org`. Because that superdataset is itself made of subdatasets, cloning
14it gives a browsable tree of dataset names with no data in it, which is the intended way
15to explore before choosing.

Finding published datasets

SourceWhat it holdsHow to reach it
registry.datalad.orgSearch across discovered DataLad and git-annex datasets, indexing URL, dataset ID, branches, tags, and metadataSearch box supports a bare word, a quoted phrase, AND/OR/NOT, and field-specific terms; results give clone URLs
datasets.datalad.orgThe DataLad superdataset, a nested collection of curated public datasetsdatalad clone /// for the superdataset, datalad clone ///<name> for one entry
OpenNeuroDatasetsPublic BIDS neuroimaging datasets from OpenNeuro, one repository per accessiondatalad clone https://github.com/OpenNeuroDatasets/ds00XXXX.git
dandisetsDANDI archive dandisets, mostly neurophysiology in NWBdatalad clone https://github.com/dandisets/000XXX.git

The /// shortcut is a DataLad resource identifier that resolves to the superdataset on datasets.datalad.org. Because that superdataset is itself made of subdatasets, cloning it gives a browsable tree of dataset names with no data in it, which is the intended way to explore before choosing.

Raw lines 3 to 16
17## Cloning
19```
20datalad clone [-h] [-d DATASET] [-D DESCRIPTION] [--reckless
21 [auto|ephemeral|shared-...]] [-m MESSAGE] [-c PROC] [--version]
22 SOURCE [PATH] ...
23```
25`SOURCE` accepts a URL, a local path, the `///` shortcut, or a RIA store URL such as
26`ria+http://store.datalad.org#~hcp-openaccess`.
28- `-d/--dataset` registers the new clone as a subdataset of the given parent, which is the
29 correct way to bring external data into a project rather than copying it in.
30- `--reckless auto` hard-links content between clones on the same filesystem, and
31 `--reckless ephemeral` symlinks the annex to the origin's annex. Both trade safety for
32 speed and disk, and both are recorded in local config and inherited by subdatasets. Use
33 them for throwaway clones on a cluster, not for anything you will edit and push. For
34 maintaining multiple concurrent checkouts of the same dataset without re-cloning, see
35 the [git worktree workflow with DataLad](https://blog.datalad.org/posts/git-worktree-workflow/)
36 post.
37- `-D/--description` labels this particular copy. git-annex reports that label in
38 `whereis` output, so a meaningful description ("scratch on cluster node") is what makes
39 copy tracking readable later.

Cloning

datalad clone [-h] [-d DATASET] [-D DESCRIPTION] [--reckless
    [auto|ephemeral|shared-...]] [-m MESSAGE] [-c PROC] [--version]
    SOURCE [PATH] ...

SOURCE accepts a URL, a local path, the /// shortcut, or a RIA store URL such as ria+http://store.datalad.org#~hcp-openaccess.

  • -d/--dataset registers the new clone as a subdataset of the given parent, which is the correct way to bring external data into a project rather than copying it in.
  • --reckless auto hard-links content between clones on the same filesystem, and --reckless ephemeral symlinks the annex to the origin's annex. Both trade safety for speed and disk, and both are recorded in local config and inherited by subdatasets. Use them for throwaway clones on a cluster, not for anything you will edit and push. For maintaining multiple concurrent checkouts of the same dataset without re-cloning, see the git worktree workflow with DataLad post.
  • -D/--description labels this particular copy. git-annex reports that label in whereis output, so a meaningful description ("scratch on cluster node") is what makes copy tracking readable later.
Raw lines 17 to 40
41## Retrieving content
43```
44datalad get [-h] [-s LABEL] [-d PATH] [-r] [-R LEVELS] [-n] [-c PROC] [-D
45 DESCRIPTION] [--reckless [auto|ephemeral|shared-...]] [-J NJOBS]
46 [--data {anything|nothing|auto|auto-if-wanted}] [--version]
47 [PATH ...]
48```
50- `-r/--recursive` descends into subdatasets, and `-R/--recursion-limit` bounds the depth.
51 `-R existing` limits recursion to subdatasets already installed.
52- `-n/--no-data` installs subdatasets without fetching any file content. This is the usual
53 first move on a nested dataset: get the structure, look at it, then fetch selectively.
54- `-s/--source` names a specific sibling to fetch from when several could serve the file.
55- `-J/--jobs` parallelises retrieval, and `-J auto` uses the configured maximum. On a
56 dataset of many small files this is the difference between minutes and hours.
58DataLad 1.6.5 also has `--data`: its `auto-if-wanted` default honors configured
59local wanted settings and otherwise retrieves requested content. Use `--data anything`
60when the requested inputs must be fetched regardless of that preference. `--data nothing`
61and `-n` skip file content. This controls retrieval, not analysis parallelism.
63When resolving where a subdataset lives, DataLad ranks candidate locations by cost,
64considering the recorded URL, the superdataset's remote URL, and configured URL templates.
65A subdataset that fails to install from its recorded URL can often still be reached
66through the superdataset's own hosting.

Retrieving content

datalad get [-h] [-s LABEL] [-d PATH] [-r] [-R LEVELS] [-n] [-c PROC] [-D
    DESCRIPTION] [--reckless [auto|ephemeral|shared-...]] [-J NJOBS]
    [--data {anything|nothing|auto|auto-if-wanted}] [--version]
    [PATH ...]
  • -r/--recursive descends into subdatasets, and -R/--recursion-limit bounds the depth. -R existing limits recursion to subdatasets already installed.
  • -n/--no-data installs subdatasets without fetching any file content. This is the usual first move on a nested dataset: get the structure, look at it, then fetch selectively.
  • -s/--source names a specific sibling to fetch from when several could serve the file.
  • -J/--jobs parallelises retrieval, and -J auto uses the configured maximum. On a dataset of many small files this is the difference between minutes and hours.

DataLad 1.6.5 also has --data: its auto-if-wanted default honors configured local wanted settings and otherwise retrieves requested content. Use --data anything when the requested inputs must be fetched regardless of that preference. --data nothing and -n skip file content. This controls retrieval, not analysis parallelism.

When resolving where a subdataset lives, DataLad ranks candidate locations by cost, considering the recorded URL, the superdataset's remote URL, and configured URL templates. A subdataset that fails to install from its recorded URL can often still be reached through the superdataset's own hosting.

Raw lines 41 to 67
68## Annex content states
70Every annexed file has two things that can independently exist:
721. The **pointer**, tracked in Git. It is a symlink into `.git/annex/objects/`, or a small
73 plain file containing an annex key on filesystems without symlinks. Deleting it removes
74 the file from the dataset.
752. The **content**, the actual bytes. They live in the local annex, on a remote, or both.
77| Pointer | Content local | What you see |
78|---|---|---|
79| present | present | Normal file, readable |
80| present | absent | Listed by `ls`, unreadable, restorable with `datalad get` |
81| absent | not applicable | Gone from the dataset's working tree |
83Inspect the state rather than guessing:
85```bash
86datalad status --annex availability # local availability plus annex key/size
87git annex whereis <path> # which repositories hold this file, and how many copies
88git annex whereis --json <path> # same, machine-readable, one JSON object per line
89git annex list <path> # compact matrix of files against remotes
90```
92`git annex whereis` reports the last information received from remotes and does not
93contact them, so a remote that has since lost the file will still be listed. Treat it as a
94record of belief, not a live check.

Annex content states

Every annexed file has two things that can independently exist:

  1. The pointer, tracked in Git. It is a symlink into .git/annex/objects/, or a small plain file containing an annex key on filesystems without symlinks. Deleting it removes the file from the dataset.
  2. The content, the actual bytes. They live in the local annex, on a remote, or both.
PointerContent localWhat you see
presentpresentNormal file, readable
presentabsentListed by ls, unreadable, restorable with datalad get
absentnot applicableGone from the dataset's working tree

Inspect the state rather than guessing:

datalad status --annex availability # local availability plus annex key/size
git annex whereis <path>         # which repositories hold this file, and how many copies
git annex whereis --json <path>  # same, machine-readable, one JSON object per line
git annex list <path>            # compact matrix of files against remotes

git annex whereis reports the last information received from remotes and does not contact them, so a remote that has since lost the file will still be listed. Treat it as a record of belief, not a live check.

Raw lines 68 to 95
96## Editing annexed files
98git-annex write-protects annexed content, so a direct write to an annexed file fails with
99a permission error even as the owner. That is deliberate: the file's content is
100content-addressed and shared by hard link with the annex object, so writing in place would
101corrupt every other reference to it.
103```bash
104datalad unlock <path> # make it writable
105# edit
106datalad save -m "revise <path>" <path> # record the revised annex content
107```
109The tested default re-locks the saved file. Unlocked/adjusted configurations can behave
110differently; inspect status instead of assuming a worktree representation.
112Inside `datalad run`, declaring the file with `--output` performs the unlock
113automatically, which is why the flag matters beyond documentation.

Editing annexed files

git-annex write-protects annexed content, so a direct write to an annexed file fails with a permission error even as the owner. That is deliberate: the file's content is content-addressed and shared by hard link with the annex object, so writing in place would corrupt every other reference to it.

datalad unlock <path>            # make it writable
# edit
datalad save -m "revise <path>" <path> # record the revised annex content

The tested default re-locks the saved file. Unlocked/adjusted configurations can behave differently; inspect status instead of assuming a worktree representation.

Inside datalad run, declaring the file with --output performs the unlock automatically, which is why the flag matters beyond documentation.

Raw lines 96 to 114
115## Releasing content
117```
118datalad drop [-h] [--what {filecontent|allkeys|datasets|all}] [--reckless
119 {modification|availability|undead|kill}] [-d DATASET] [-r] [-R LEVELS] [-J NJOBS]
120 [--nocheck] [--if-dirty IF_DIRTY] [--version] [PATH ...]
121```
123- `--what filecontent` is the default and drops only file content, leaving pointers and
124 the dataset intact.
125- `--what allkeys` drops all keys including those not currently in the working tree,
126 `--what datasets` uninstalls subdatasets, and `--what all` does both.
127- `--reckless availability` overrides the check that another copy exists. This is the
128 option that loses data when the check was right.
129- `--reckless modification` allows dropping despite unsaved modifications,
130 `--reckless undead` skips checking whether the annex being removed remains
131 recorded as alive elsewhere (and can leave stale availability records), and `--reckless kill` is a last-resort removal.
132- `--nocheck` and `--if-dirty` are deprecated. `--nocheck` is replaced by
133 `--reckless availability`; `--if-dirty` is ignored entirely.
135The real check is `datalad drop`'s own refusal to remove content it cannot verify
136elsewhere; the commands below are a pre-flight look at what `whereis` already believes:
138```bash
139git annex whereis <path> # read the copy list yourself
140git annex whereis --json <path> | jq '.whereis | length' # count known copies
141datalad push --to store # make a second copy where none was, then
142datalad drop <path>
143```
145`whereis` prints one `N copies` line per file, so a pipe into `grep -c 'copies'` returns
146the file count, not the copy count — for a single file it always prints `1`, whether the
147content exists in five places or nowhere but the local annex. The JSON form is what you
148want when a script has to decide.
150Use `drop` to free annexed bytes while retaining the tracked file. `rm` removes the
151worktree pointer (it does not leave that pointer behind); `git rm` also stages its
152removal. Neither ordinarily removes the annex object, so deleting a pointer is not a
153substitute for dropping content. Removing a tracked file can be intentional; save that
154deletion only when it is the intended dataset change.

Releasing content

datalad drop [-h] [--what {filecontent|allkeys|datasets|all}] [--reckless
    {modification|availability|undead|kill}] [-d DATASET] [-r] [-R LEVELS] [-J NJOBS]
    [--nocheck] [--if-dirty IF_DIRTY] [--version] [PATH ...]
  • --what filecontent is the default and drops only file content, leaving pointers and the dataset intact.
  • --what allkeys drops all keys including those not currently in the working tree, --what datasets uninstalls subdatasets, and --what all does both.
  • --reckless availability overrides the check that another copy exists. This is the option that loses data when the check was right.
  • --reckless modification allows dropping despite unsaved modifications, --reckless undead skips checking whether the annex being removed remains recorded as alive elsewhere (and can leave stale availability records), and --reckless kill is a last-resort removal.
  • --nocheck and --if-dirty are deprecated. --nocheck is replaced by --reckless availability; --if-dirty is ignored entirely.

The real check is datalad drop's own refusal to remove content it cannot verify elsewhere; the commands below are a pre-flight look at what whereis already believes:

git annex whereis <path>                                # read the copy list yourself
git annex whereis --json <path> | jq '.whereis | length'  # count known copies
datalad push --to store   # make a second copy where none was, then
datalad drop <path>

whereis prints one N copies line per file, so a pipe into grep -c 'copies' returns the file count, not the copy count — for a single file it always prints 1, whether the content exists in five places or nowhere but the local annex. The JSON form is what you want when a script has to decide.

Use drop to free annexed bytes while retaining the tracked file. rm removes the worktree pointer (it does not leave that pointer behind); git rm also stages its removal. Neither ordinarily removes the annex object, so deleting a pointer is not a substitute for dropping content. Removing a tracked file can be intentional; save that deletion only when it is the intended dataset change.

Raw lines 115 to 155
156## Repair and verification
158`fsck` belongs to git-annex, not to DataLad, so call it directly:
160```bash
161git annex fsck # verify local content against recorded checksums
162git annex fsck --fast # skip checksum verification, check presence only
163git annex fsck --from <remote> --fast # presence check without downloading all bytes
164git annex fsck --from <remote> # full check; can retrieve remote content
165git annex unused # find annex objects no longer referenced
166git annex dropunused <number> # selected entry from the unused report
167```
169`fsck --from` contacts the remote; checksum support and download cost depend on remote
170type. It is one way to check recorded availability, alongside actual retrieval and
171the verification performed by a safe drop. Review `unused` entries before removing
172them: content absent from the current worktree may still matter to historical results.
173Check `datalad wtf --section dependencies` when behavior differs from the manuals.
175The registry count changes continuously. Its live frontend and search syntax were
176reviewed on 2026-09-30; see also the
177[official registry guide](https://blog.datalad.org/posts/registry/). Public dataset
178locations were checked as Git repository metadata only, without downloading their
179annexed scientific data. Registry search is case-insensitive substring search; group
180mixed AND/OR expressions with parentheses as the frontend instructs.

Repair and verification

fsck belongs to git-annex, not to DataLad, so call it directly:

git annex fsck                       # verify local content against recorded checksums
git annex fsck --fast                # skip checksum verification, check presence only
git annex fsck --from <remote> --fast # presence check without downloading all bytes
git annex fsck --from <remote>        # full check; can retrieve remote content
git annex unused                     # find annex objects no longer referenced
git annex dropunused <number>        # selected entry from the unused report

fsck --from contacts the remote; checksum support and download cost depend on remote type. It is one way to check recorded availability, alongside actual retrieval and the verification performed by a safe drop. Review unused entries before removing them: content absent from the current worktree may still matter to historical results. Check datalad wtf --section dependencies when behavior differs from the manuals.

The registry count changes continuously. Its live frontend and search syntax were reviewed on 2026-09-30; see also the official registry guide. Public dataset locations were checked as Git repository metadata only, without downloading their annexed scientific data. Registry search is case-insensitive substring search; group mixed AND/OR expressions with parentheses as the frontend instructs.

Raw lines 156 to 180