Skip to content

Commit 14e3c0b

Browse files
zeroshadeianmcook
andauthored
docs: document the --pre option (#297)
Adds documentation for the `--pre` option that was added to multiple subcommands. --------- Co-authored-by: Ian Cook <ianmcook@gmail.com>
1 parent 056d707 commit 14e3c0b

5 files changed

Lines changed: 193 additions & 3 deletions

File tree

docs/guides/driver_list.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,58 @@ $ cat dbc.toml
112112
version = '=0.1.0'
113113
```
114114

115+
## Pre-release Versions
116+
117+
{{ since_version('v0.2.0') }}
118+
119+
### Allowing Pre-release Versions
120+
121+
By default, when you add a driver to a driver list, dbc will only consider stable (non-pre-release) versions. If you want to allow pre-release versions when running `dbc sync`, use the `--pre` flag with `dbc add`:
122+
123+
```console
124+
$ dbc add --pre mysql
125+
added mysql to driver list
126+
use `dbc sync` to install the drivers in the list
127+
$ cat dbc.toml
128+
[drivers]
129+
[drivers.mysql]
130+
prerelease = 'allow'
131+
```
132+
133+
The `prerelease = 'allow'` field tells `dbc sync` to consider pre-release versions when resolving which version to install.
134+
135+
!!! note
136+
The `prerelease = 'allow'` field only affects implicit version resolution. When your version constraint unambiguously references a pre-release (by including a pre-release suffix like `-beta.1`), that constraint will match pre-release versions regardless of the `prerelease` field.
137+
138+
### Adding Specific Pre-release Versions
139+
140+
You can add a driver with a version constraint that references a specific pre-release version without using the `--pre` flag. When your version constraint unambiguously references a pre-release by including a pre-release suffix, the `prerelease` field is not added:
141+
142+
```console
143+
$ dbc add "mysql=1.0.0-beta.1"
144+
added mysql to driver list with constraint =1.0.0-beta.1
145+
use `dbc sync` to install the drivers in the list
146+
$ cat dbc.toml
147+
[drivers]
148+
[drivers.mysql]
149+
version = '=1.0.0-beta.1'
150+
```
151+
152+
The version constraint `=1.0.0-beta.1` unambiguously indicates you want a pre-release, so `prerelease = 'allow'` is not needed.
153+
154+
However, if your version constraint is ambiguous and only a pre-release version satisfies it, `dbc sync` will fail rather than install the pre-release. For example, if a driver has versions `0.1.0` and `0.1.1-beta.1`:
155+
156+
```toml
157+
[drivers.mysql]
158+
version = '>0.1.0'
159+
# dbc sync will FAIL, not install 0.1.1-beta.1
160+
```
161+
162+
To allow `0.1.1-beta.1` to be installed in this case, you must either:
163+
164+
- Use `dbc add --pre` to add `prerelease = 'allow'`
165+
- Change the constraint to reference the pre-release: `version = '>=0.1.1-beta.1'`
166+
115167
## Removing Drivers
116168

117169
Drivers can be removed from a driver list with the `dbc remove` command:

docs/guides/finding_drivers.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,42 @@ $ dbc search --verbose
172172
Available Versions:
173173
╰── 0.1.1
174174
```
175+
176+
### Pre-release Versions
177+
178+
{{ since_version('v0.2.0') }}
179+
180+
By default, `dbc search` hides pre-release versions from search results. Pre-release versions follow semantic versioning conventions and include version identifiers like `1.0.0-alpha.1`, `2.0.0-beta.3`, or `1.5.0-rc.1`.
181+
182+
To include pre-release versions in search results, use the `--pre` flag:
183+
184+
```console
185+
$ dbc search --pre
186+
```
187+
188+
Without `--pre`, `dbc search` will:
189+
190+
- Hide drivers that have exclusively pre-release versions (no stable versions)
191+
- Exclude pre-release versions from the available versions list
192+
193+
With `--pre`, `dbc search` will:
194+
195+
- Show drivers even if they have exclusively pre-release versions
196+
- Include pre-release versions in the available versions list when using `--verbose`
197+
198+
For example, with `--pre --verbose`:
199+
200+
```console
201+
$ dbc search --pre --verbose mysql
202+
• mysql
203+
Title: ADBC Driver Foundry Driver for MySQL
204+
Description: An ADBC Driver for MySQL developed by the ADBC Driver Foundry
205+
License: Apache-2.0
206+
Available Versions:
207+
├── 0.1.0
208+
├── 0.2.0-beta.1
209+
╰── 0.2.0
210+
```
211+
212+
!!! note
213+
Using the `--pre` flag with `dbc search` only affects the visibility of pre-release versions in search results. To actually install a pre-release version, you need to either use `--pre` with `dbc install` or use a version constraint that unambiguously references a pre-release (by including a pre-release suffix like `-beta.1`).

docs/guides/installing.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,46 @@ The syntax for specifying a version may be familiar to you if you've used other
7474
!!! note
7575
dbc uses the [github.com/Masterminds/semver/v3](https://pkg.go.dev/github.com/Masterminds/semver/v3#section-readme) package whose README has a good overview of the syntax it allows. In short, you can use `=`, `!=`, `>`, `<`, `>=`, `<=`, `~`, `^`, ranges like `1.2 - 1.4.5`, and wildcards (`x`, `X`, or `*`).
7676

77+
## Pre-release Versions
78+
79+
{{ since_version('v0.2.0') }}
80+
81+
### Allowing Pre-release Versions
82+
83+
By default, dbc acts as if pre-release versions don't exist when searching for and installing drivers. Pre-release versions follow semantic versioning conventions and include version identifiers like `1.0.0-alpha.1`, `2.0.0-beta.3`, or `1.5.0-rc.1`.
84+
85+
To allow dbc to install a pre-release version when it's the newest version available, use the `--pre` flag:
86+
87+
```console
88+
$ dbc install --pre mysql
89+
```
90+
91+
This will allow dbc to consider pre-release versions when selecting the latest version to install.
92+
93+
!!! note
94+
The `--pre` flag allows dbc to install a pre-release version when you didn't ask for it explicitly. Without `--pre`, your version constraint must contain a pre-release suffix (like `-beta.1`) for dbc to consider pre-release versions.
95+
96+
### Installing Specific Pre-release Versions
97+
98+
You can install a specific pre-release version without using the `--pre` flag if your version constraint unambiguously references a pre-release by including a pre-release suffix:
99+
100+
```console
101+
$ dbc install "mysql=1.0.0-beta.1"
102+
$ dbc install "mysql>=1.0.0-beta.1"
103+
```
104+
105+
However, if your version constraint is ambiguous and only a pre-release version satisfies it, dbc will fail rather than install the pre-release. For example, if a driver has versions `0.1.0` and `0.1.1-beta.1`:
106+
107+
```console
108+
$ dbc install "mysql>0.1.0"
109+
# This will FAIL, not install 0.1.1-beta.1
110+
```
111+
112+
To install `0.1.1-beta.1` in this case, you must either:
113+
114+
- Use `--pre`: `dbc install --pre "mysql>0.1.0"`
115+
- Reference the pre-release explicitly: `dbc install "mysql>=0.1.1-beta.1"`
116+
77117
## Updating a Driver
78118

79119
dbc doesn't offer a specific "update" or "upgrade" command but `dbc install` can do essentially the same thing.

docs/reference/cli.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ $ dbc search [PATTERN]
7171

7272
: Print output as JSON instead of plaintext
7373

74+
`--pre` {{ since_version('v0.2.0') }}
75+
76+
: Include pre-release drivers and versions (hidden by default)
77+
7478
`--verbose`, `-v`
7579

7680
: Enable verbose output
@@ -111,6 +115,10 @@ $ dbc install [OPTIONS] <DRIVER>
111115

112116
: Allow installation of drivers without a signature file
113117

118+
`--pre` {{ since_version('v0.2.0') }}
119+
120+
: Allow implicit installation of pre-release versions
121+
114122
`--quiet`, `-q`
115123

116124
: Suppress all output
@@ -189,6 +197,10 @@ $ dbc add <DRIVER>
189197

190198
: Driver list to add to [default: ./dbc.toml]
191199

200+
`--pre` {{ since_version('v0.2.0') }}
201+
202+
: Allow pre-release versions implicitly
203+
192204
`--quiet`, `-q`
193205

194206
: Suppress all output

docs/reference/driver_list.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ limitations under the License.
1919
`dbc.toml` is the default filename dbc uses for a [driver list](../concepts/driver_list.md). This page outlines the structure of that file.
2020

2121
This file uses the [TOML](https://toml.io) file format and contains a single TOML Table called "drivers".
22-
Each driver must have a name and may optionally have a version constraint. See [Version Constraints](../guides/installing.md#version-constraints) to learn how to specify version constraints.
22+
Each driver must have a name and may optionally have a version constraint and pre-release setting. See [Version Constraints](../guides/installing.md#version-constraints) to learn how to specify version constraints.
2323

2424
## Example
2525

2626
The following driver list specifies:
2727

28-
- Whatever is the latest version of the "mysql" driver
28+
- Whatever is the latest stable version of the "mysql" driver
2929
- The exact 1.4.0 version of the "duckdb" driver
30-
- The latest version in the 1.x.x major series for the "postgresql" driver.
30+
- The latest stable version in the 1.x.x major series for the "postgresql" driver
31+
- The latest version (including pre-releases) of the "snowflake" driver
3132

3233
```toml
3334
[drivers]
@@ -39,4 +40,50 @@ version = '=1.4.0'
3940

4041
[drivers.postgresql]
4142
version = '=1.x.x'
43+
44+
[drivers.snowflake]
45+
prerelease = 'allow'
46+
```
47+
48+
## Fields
49+
50+
### `version`
51+
52+
Optional. A version constraint string that specifies which versions of the driver are acceptable. If omitted, dbc will use the latest stable version available.
53+
54+
See [Version Constraints](../guides/installing.md#version-constraints) for the full syntax.
55+
56+
### `prerelease`
57+
58+
{{ since_version('v0.2.0') }}
59+
60+
Optional. Controls whether pre-release versions should be considered during version resolution.
61+
62+
- When set to `'allow'`, dbc will consider pre-release versions when selecting which version to install
63+
- When omitted or set to any other value, only stable (non-pre-release) versions will be considered
64+
65+
This field is typically set automatically when using `dbc add --pre`.
66+
67+
**Example:**
68+
69+
```toml
70+
[drivers.mysql]
71+
prerelease = 'allow'
72+
```
73+
74+
**Interaction with version constraints:**
75+
76+
The `prerelease` field only affects implicit version resolution. When your `version` constraint unambiguously references a pre-release by including a pre-release suffix (like `version = '>=1.0.0-beta.1'`), pre-release versions will be considered regardless of this field.
77+
78+
However, if your version constraint is ambiguous and only pre-release versions satisfy it, `dbc sync` will fail unless `prerelease = 'allow'` is set. For example, if a driver has versions `0.1.0` and `0.1.1-beta.1`:
79+
80+
```toml
81+
[drivers.mysql]
82+
version = '>0.1.0'
83+
# This will FAIL during sync, not install 0.1.1-beta.1
4284
```
85+
86+
To allow the pre-release in this case, either:
87+
88+
- Add `prerelease = 'allow'`
89+
- Change the constraint to reference the pre-release: `version = '>=0.1.1-beta.1'`

0 commit comments

Comments
 (0)