Skip to content

Commit d3cb2a6

Browse files
committed
Connect: Add Julia
1 parent c2721f4 commit d3cb2a6

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

docs/_assets/icon/julia-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/connect/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ CrateDB drivers and adapters for supported programming languages, frameworks, an
7373
{material-regular}`javascript;2em`
7474
::::
7575

76+
::::{grid-item-card} Julia
77+
:link: connect-julia
78+
:link-type: ref
79+
:link-alt: Connect to CrateDB using Julia
80+
:padding: 3
81+
:text-align: center
82+
:class-card: sd-pt-3
83+
:class-body: sd-fs-1
84+
:class-title: sd-fs-6
85+
```{image} /_assets/icon/julia-logo.svg
86+
:height: 40px
87+
```
88+
::::
89+
7690
::::{grid-item-card} PHP
7791
:link: connect-php
7892
:link-type: ref
@@ -184,6 +198,7 @@ application
184198
185199
java
186200
javascript
201+
julia/index
187202
php
188203
python
189204
ruby

docs/connect/julia/index.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
(connect-julia)=
2+
3+
# Julia
4+
5+
:::{div} sd-text-muted
6+
Connect to CrateDB from Julia applications.
7+
:::
8+
9+
:::{rubric} About
10+
:::
11+
12+
[LibPQ.jl] is a Julia wrapper for the PostgreSQL libpq C library.
13+
14+
:::{rubric} Synopsis
15+
:::
16+
17+
`setup.jl`
18+
```julia
19+
using Pkg
20+
Pkg.add("LibPQ")
21+
Pkg.add("Tables")
22+
```
23+
`example.jl`
24+
```julia
25+
using LibPQ
26+
using Tables
27+
28+
conn = LibPQ.Connection("postgresql://crate:crate@localhost:5432/?sslmode=disable");
29+
result = LibPQ.execute(conn, "SELECT mountain, region, height FROM sys.summits ORDER BY height DESC LIMIT 3")
30+
data = rowtable(result)
31+
for row in data
32+
println(row)
33+
end
34+
```
35+
36+
:::{include} ../_cratedb.md
37+
:::
38+
```shell
39+
julia setup.jl
40+
julia example.jl
41+
```
42+
43+
:::{rubric} CrateDB Cloud
44+
:::
45+
46+
For connecting to CrateDB Cloud, use the `sslmode=require`
47+
parameter, and replace username, password, and hostname with values matching
48+
your environment.
49+
```julia
50+
conn = LibPQ.Connection("postgresql://admin:[email protected]:5432/doc?sslmode=require");
51+
```
52+
53+
:::{rubric} Learn
54+
:::
55+
56+
- See also [Exploring the Power of PostgreSQL with Julia: A Beginners Guide]
57+
58+
59+
[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
60+
[LibPQ.jl]: https://github.com/JuliaDatabases/LibPQ.jl

0 commit comments

Comments
 (0)