Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/getting_started/first_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ With our cursor, we can execute the following query:
... spc_latin,
... spc_common
... ORDER BY
... count DESC
...""")
... count DESC""")
```

To get the data out of the query, we run:
Expand Down
40 changes: 20 additions & 20 deletions docs/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ The following commands will automatically install the latest version of dbc suit

To automatically install dbc, run:

```sh
curl -LsSf https://dbc.columnar.tech/install.sh | sh
```console
$ curl -LsSf https://dbc.columnar.tech/install.sh | sh
```

If your system doesn't have `curl` you can also use `wget`:

```sh
wget -q0- https://dbc.columnar.tech/install.sh | sh
```console
$ wget -q0- https://dbc.columnar.tech/install.sh | sh
```

If you want to inspect the script before use, you can simply run:

```sh
curl -LsSf https://dbc.columnar.tech/install.sh | less
```console
$ curl -LsSf https://dbc.columnar.tech/install.sh | less
```

=== "Windows"

Use `irm` to download the script and execute it with `iex`:

```sh
powershell -ExecutionPolicy ByPass -c "irm https://dbc.columnar.tech/install.ps1 | iex
```console
$ powershell -ExecutionPolicy ByPass -c "irm https://dbc.columnar.tech/install.ps1 | iex
```

Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4#powershell-execution-policies) allows running a script from the internet.

Of course, you can also inspect the script before use:

```sh
powershell -c "irm https://dbc.columnar.tech/install.ps1 | more"
```console
$ powershell -c "irm https://dbc.columnar.tech/install.ps1 | more"
```

## PyPI
Expand All @@ -53,24 +53,24 @@ dbc is published as a package on [PyPI](https://pypi.org/project/dbc) for conven

To install dbc with [pipx](https://pipx.pypa.io/stable/installation/), run,

```sh
pipx install dbc
```console
$ pipx install dbc
```

If you only want to run dbc to test it out, run,

```sh
pipx run dbc
```console
$ pipx run dbc
```

### Virtual Environment

Installing dbc inside a virtual environment automatically handles installing dbc and adding it to your `$PATH`:

```sh
python -m venv .venv
source .venv/bin/activate
pip install dbc
```console
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install dbc
```

## GitHub Releases
Expand All @@ -93,8 +93,8 @@ We publish [Docker](https://docker.io) images for each dbc release.

Run the latest version of dbc under Docker by running:

```sh
docker run --rm -it columnar/dbc:latest --help
```console
$ docker run --rm -it columnar/dbc:latest --help
```

### Available Images
Expand Down
5 changes: 0 additions & 5 deletions docs/guides/driver_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ $ dbc init
$ ls
dbc.toml
$ cat dbc.toml
# dbc driver list

[drivers]

```
Expand All @@ -38,7 +36,6 @@ $ dbc add mysql
added mysql to driver list
use `dbc sync` to install the drivers in the list
$ cat dbc.toml
# dbc driver list
[drivers]
[drivers.mysql]
```
Expand Down Expand Up @@ -75,7 +72,6 @@ The lockfile records the exact version of the drivers that were installed, inclu

```console
$ cat dbc.lock
# This file is automatically @generated by dbc. Not intended for manual editing
version = 1

[[drivers]]
Expand All @@ -97,7 +93,6 @@ $ dbc add "mysql=0.1.0"
added mysql to driver list with constraint =0.1.0
use `dbc sync` to install the drivers in the list
$ cat dbc.toml
# dbc driver list
[drivers]
[drivers.mysql]
version = '=0.1.0'
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Install dbc with our automated installer:

=== "macOS and Linux"

```sh
curl -LsSf https://dbc.columnar.tech/install.sh | sh
```console
$ curl -LsSf https://dbc.columnar.tech/install.sh | sh
```

=== "Windows"

```sh
powershell -ExecutionPolicy ByPass -c "irm https://dbc.columnar.tech/install.ps1 | iex
```console
$ powershell -ExecutionPolicy ByPass -c "irm https://dbc.columnar.tech/install.ps1 | iex
```

Then, take your [first steps](getting_started/first_steps.md) to get started using dbc.
Expand Down
32 changes: 16 additions & 16 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Notes on how this document is structured:

<h3>Usage</h3>

```sh
dbc [OPTIONS] <COMMAND>
```console
$ dbc [OPTIONS] <COMMAND>
```

<h2>Commands</h2>
Expand All @@ -38,8 +38,8 @@ Search for a driver to install.

<h3>Usage</h3>

```sh
dbc search [PATTERN]
```console
$ dbc search [FILTER]
```

<h3>Arguments</h3>
Expand All @@ -66,8 +66,8 @@ To install multiple versions of the same driver on the same system, it's recomme

<h3>Usage</h3>

```sh
dbc install [OPTIONS] <DRIVER>
```console
$ dbc install [OPTIONS] <DRIVER>
```

<h3>Arguments</h3>
Expand All @@ -92,8 +92,8 @@ Uninstall a driver.

<h3>Usage</h3>

```sh
dbc uninstall [OPTIONS] <DRIVER>
```console
$ dbc uninstall [OPTIONS] <DRIVER>
```

<h3>Arguments</h3>
Expand All @@ -114,8 +114,8 @@ Create a [driver list](../concepts/driver_list.md) file.

<h3>Usage</h3>

```sh
dbc init [PATH]
```console
$ dbc init [PATH]
```

<h3>Arguments</h3>
Expand All @@ -130,8 +130,8 @@ Add a driver to a current [driver list](../concepts/driver_list.md).

<h3>Usage</h3>

```sh
dbc add <DRIVER>
```console
$ dbc add <DRIVER>
```

<h3>Arguments</h3>
Expand All @@ -152,8 +152,8 @@ Remove a driver from the current [driver list](../concepts/driver_list.md).

<h3>Usage</h3>

```sh
dbc remove <DRIVER>
```console
$ dbc remove <DRIVER>
```

<h3>Arguments</h3>
Expand All @@ -176,8 +176,8 @@ If `dbc.lock` exists, driver versions from it will be used when this subcommand

<h3>Usage</h3>

```sh
dbc sync
```console
$ dbc sync
dbc sync --file dbc.toml
```

Expand Down
96 changes: 96 additions & 0 deletions docs/scripts/extra.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Adapted from https://github.com/astral-sh/uv/blob/main/docs/js/extra.js which
// is dual-licensed as MIT & Apache 2.0. See https://github.com/astral-sh/uv and
// https://docs.astral.sh/uv/.
//
// This code is very similar but two changes were made:
//
// - The logic in cleanupClipboardText handles a different DOM structure
// - Some of the code was reorganized and some comments were added

// Exclude "Generic Prompt" and "Generic Output" spans from copy
// Generic Prompt includes "$ " (shell) and ">>> "/"... " (Python console)
// Generic Output includes command/console output
const excludedClasses = ["gp", "go"];

function cleanupClipboardText(targetSelector) {
const targetElement = document.querySelector(targetSelector);

// targetElement has one or more spans for each line and each line has one or
// more spans for segments of a line. It's the segments of each line we want
// to clean up
//
// <code> <-- code block
// <span> <-- line in code block
// <span></span> <-- segment in a line
// <span></span> <-- segment in a line
// <span></span> <-- segment in a line
// </span>
// <span>...</span>
// <span>...</span>
// </code>

const lines = Array.from(targetElement.childNodes) // <-- array of lines
.map((span_el) => {
const segments = Array.from(span_el.childNodes).filter( // <-- array of segments
(node) => !excludedClasses.some((excludedClass) =>
node?.classList?.contains(excludedClass)
)
);

const lineText = segments
.map((node) => node.textContent)
.filter((s) => s != "").join("");

// For Python console blocks, preserve leading whitespace but remove trailing whitespace
// This maintains indentation which is crucial for Python syntax
return lineText.replace(/\s+$/, '');
});

// Remove only leading and trailing empty lines, but preserve empty lines within the content
// This is important for structured data formats like YAML, TOML, JSON where blank lines
// provide visual structure and readability
const firstNonEmpty = lines.findIndex(line => line.trim() !== '');
const lastNonEmpty = lines.findLastIndex(line => line.trim() !== '');

if (firstNonEmpty === -1) {
return ''; // All lines are empty
}

return lines.slice(firstNonEmpty, lastNonEmpty + 1).join('\n')
}

// Sets copy text to attributes lazily using an Intersection Observer.
function setCopyText() {
// The `data-clipboard-text` attribute allows for customized content in the copy
// See: https://www.npmjs.com/package/clipboard#copy-text-from-attribute
const attr = "clipboardText";
// all "copy" buttons whose target selector is a <code> element
const elements = document.querySelectorAll(
'button[data-clipboard-target$="code"]'
);
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
// target in the viewport that have not been patched
if (
entry.intersectionRatio > 0 &&
entry.target.dataset[attr] === undefined
) {
entry.target.dataset[attr] = cleanupClipboardText(
entry.target.dataset.clipboardTarget
);
}
});
});

elements.forEach((elt) => {
observer.observe(elt);
});
}

// Using the document$ observable is particularly important if you are using instant loading since
// it will not result in a page refresh in the browser
// See `How to integrate with third-party JavaScript libraries` guideline:
// https://squidfunk.github.io/mkdocs-material/customization/?h=javascript#additional-javascript
document$.subscribe(function () {
setCopyText();
});
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,7 @@ extra_css:
- stylesheets/extra.css
exclude_docs: |
README.md
extra_javascript:
- scripts/extra.js
plugins:
- privacy
Loading