Skip to content

Skip files you don't want indexed ​

Drafts, build output, and editor droppings don't belong in your tables. ignore globs exclude files entirely — from the initial scan and from watch events alike.

1. Add ignore patterns ​

Suppose finished notes live in notes/, but drafts and scratch files hide among them:

notes/final.md
notes/drafts/wip.md
notes/scratch.md.tmp

Exclude the noise in .dirsql.toml:

toml
[dirsql]
ignore = ["notes/drafts/**", "**/*.tmp"]

[[table]]
name = "notes"
ddl     = "CREATE TABLE notes (basename TEXT)"
glob    = "notes/**/*"
on-file = '''sh -c 'for p; do printf "{\"basename\":\"%s\"}\n" "${p##*/}"; done' sh'''

Patterns match against paths relative to the config file's directory, the same way table globs do. An ignored file never reaches this config's tables — even one whose glob would match it. Path-tables and other configs' tables do not apply these patterns.

2. Confirm what made it in ​

Pass the config with -c (dirsql does not auto-load a .dirsql.toml from the current directory):

bash
dirsql query "SELECT basename FROM notes ORDER BY basename" -c ./.dirsql.toml
json
[{"basename":"final.md"}]

Notes ​

  • ignore lives in a config file, so it needs one: configless mode has no ignore list, though its path-tables still apply the built-in skip rules and respect .gitignore.
  • Narrow table globs are the other half of the story: a file matching no table's glob contributes no rows either. Use ignore for things that should never be looked at; use precise globs to shape what each table sees (Define tables for your files).
  • Embedding dirsql instead? The SDK constructor takes the same patterns via its ignore parameter (SDK reference).

Released under the MIT License.