Version Control
When using dbc in projects where version control software such as git is being used, we recommend the following:
- Use a driver list to record drivers and their version constraints instead of installing drivers manually with
dbc install - Track
dbc.tomlwith version control and always usedbc syncto install drivers after checkout - To maximize reproducibility, also track
dbc.lock - Don't track installed driver directories with version control, use
dbc.tomlinstead
Example Workflow
To help illustrate how this works in practice, see the example below for how to use dbc when collaborating with git. This assumes both developers have already installed dbc.
Developer 1 sets up dbc with the drivers their project needs:
# Create a driver list file
$ dbc init
# Add the mysql and sqlite drivers to it. Constrain sqlite's version.
$ dbc add mysql "sqlite<2"
added mysql to driver list
added sqlite to driver list with constraint <2
use `dbc sync` to install the drivers in the list
# Install the drivers from dbc.toml
$ dbc sync
✓ mysql-0.1.0
✓ sqlite-1.11.0
Done!
# Start tracking dbc.toml with git
$ git add dbc.toml
# Commit and push
$ git commit -m "Create dbc.toml"
$ git push
Developer 2 then clones the repository and uses dbc sync:
$ git clone example/repo
# Install the drivers from dbc.toml
$ dbc sync
✓ mysql-0.1.0
✓ sqlite-1.11.0
Done!
Now, at this point, both Developer 1 and Developer 2 have the same set of drivers available on their systems.