Skip to content

Commit

Permalink
Merge pull request #3609 from Tishj/install_and_load_statement_docs
Browse files Browse the repository at this point in the history
[Statements] Add `INSTALL` and `LOAD` statement docs
  • Loading branch information
szarnyasg committed Sep 11, 2024
2 parents 4be4659 + c794650 commit 980b729
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _data/menu_docs_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@
{
"page": "VACUUM",
"url": "vacuum"
},
{
"page": "LOAD / INSTALL",
"url": "load_and_install"
}
]
},
Expand Down
49 changes: 49 additions & 0 deletions docs/sql/statements/load_and_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: docu
title: LOAD / INSTALL Statements
railroad: statements/load_and_install.js
---

## `INSTALL`

The `INSTALL` statement downloads an extension so it can be loaded into a DuckDB session.

### Examples

Install the [`httpfs`]({% link docs/extensions/httpfs/overview.md %}) extension:

```sql
INSTALL httpfs;
```

Install the `h3` [Community Extension]({% link docs/extensions/community_extensions.md %}):

```sql
INSTALL h3 FROM community;
```

### Syntax

<div id="rrdiagram2"></div>

## `LOAD`

The `LOAD` statement loads an installed DuckDB extension into the current session.

### Examples

Load the [`httpfs`]({% link docs/extensions/httpfs/overview.md %}) extension:

```sql
LOAD httpfs;
```

Load the [`spatial`]({% link docs/extensions/spatial.md %}) extension:

```sql
LOAD spatial;
```

### Syntax

<div id="rrdiagram1"></div>
51 changes: 51 additions & 0 deletions js/statements/load_and_install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function GenerateLoad(options = {}) {
return Diagram([
AutomaticStack([
Keyword("LOAD"),
Expression("extension-name")
])
])
}

function GenerateInstall(options = {}) {
return Diagram([
AutomaticStack([
Optional(Keyword("FORCE"), "skip"),
Keyword("INSTALL"),
Expression("extension-name"),
Optional(
Sequence([
Keyword("FROM"),
Choice(0, [
Expression("repository"),
Expression("'repository-url'")
]),
]),
"skip"
),
Optional(
Sequence([
Keyword("VERSION"),
Expression("version-number")
]),
"skip"
)
])
])
}

function Initialize(options = {}) {
document.getElementById("rrdiagram1").classList.add("limit-width");
document.getElementById("rrdiagram1").innerHTML = GenerateLoad(options).toString();

document.getElementById("rrdiagram2").classList.add("limit-width");
document.getElementById("rrdiagram2").innerHTML = GenerateInstall(options).toString();
}

function Refresh(node_name, set_node) {
options[node_name] = set_node;
Initialize(options);
}

options = {}
Initialize()

0 comments on commit 980b729

Please sign in to comment.