diff --git a/docs/_assets/icon/julia-logo.svg b/docs/_assets/icon/julia-logo.svg new file mode 100644 index 00000000..73d8f42f --- /dev/null +++ b/docs/_assets/icon/julia-logo.svg @@ -0,0 +1 @@ +Asset 2 \ No newline at end of file diff --git a/docs/connect/index.md b/docs/connect/index.md index ffe0cae1..69741b77 100644 --- a/docs/connect/index.md +++ b/docs/connect/index.md @@ -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 @@ -184,6 +198,7 @@ application java javascript +julia/index php python ruby diff --git a/docs/connect/julia/index.md b/docs/connect/julia/index.md new file mode 100644 index 00000000..ebe90e84 --- /dev/null +++ b/docs/connect/julia/index.md @@ -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:password@testcluster.cratedb.net: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