Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/_assets/icon/julia-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/connect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ CrateDB drivers and adapters for supported programming languages, frameworks, an
{material-regular}`javascript;2em`
::::

::::{grid-item-card} Julia
:link: connect-julia
:link-type: ref
:link-alt: Connect to CrateDB using Julia
:padding: 3
:text-align: center
:class-card: sd-pt-3
:class-body: sd-fs-1
:class-title: sd-fs-6
```{image} /_assets/icon/julia-logo.svg
:height: 40px
```
::::

::::{grid-item-card} PHP
:link: connect-php
:link-type: ref
Expand Down Expand Up @@ -184,6 +198,7 @@ application

java
javascript
julia/index
php
python
ruby
Expand Down
60 changes: 60 additions & 0 deletions docs/connect/julia/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
(connect-julia)=

# Julia

:::{div} sd-text-muted
Connect to CrateDB from Julia applications.
:::

:::{rubric} About
:::

[LibPQ.jl] is a Julia wrapper for the PostgreSQL libpq C library.

:::{rubric} Synopsis
:::

`setup.jl`
```julia
using Pkg
Pkg.add("LibPQ")
Pkg.add("Tables")
```
`example.jl`
```julia
using LibPQ
using Tables

conn = LibPQ.Connection("postgresql://crate:crate@localhost:5432/?sslmode=disable");
result = LibPQ.execute(conn, "SELECT mountain, region, height FROM sys.summits ORDER BY height DESC LIMIT 3")
data = rowtable(result)
for row in data
println(row)
end
```

:::{include} ../_cratedb.md
:::
```shell
julia setup.jl
julia example.jl
```

:::{rubric} CrateDB Cloud
:::

For connecting to CrateDB Cloud, use the `sslmode=require`
parameter, and replace username, password, and hostname with values matching
your environment.
```julia
conn = LibPQ.Connection("postgresql://admin:[email protected]:5432/doc?sslmode=require");
```

:::{rubric} Learn
:::

- See also [Exploring the Power of PostgreSQL with Julia: A Beginners Guide]


[Exploring the Power of PostgreSQL with Julia: A Beginners Guide]: https://blog.stackademic.com/exploring-the-power-of-postgresql-with-julia-a-beginners-guide-88920ec9da3e?gi=231c51a85197
[LibPQ.jl]: https://github.com/JuliaDatabases/LibPQ.jl