Quick Start
Currently, users can use Datajure in two ways: as a library, or via the REPL.
Using Datajure as a Library
In an Existing Project
To use Datajure as a library in your Clojure project, you should include Datajure and all other required dependencies based on the build tool you're using.
For instance, if you're using Leiningen, add the following code snippet to the project.clj
file:
:dependencies [[com.github.clojure-finance/datajure "1.1.0"]
[org.apache.logging.log4j/log4j-core "2.21.0"]
[org.clojure/clojure "1.11.1"]]
If you are using Java 17 or newer versions, you should also specify the following JVM options in the project.clj
file:
:jvm-opts ["--add-opens=java.base/java.nio=ALL-UNNAMED"
"--add-opens=java.base/java.net=ALL-UNNAMED"
"--add-opens=java.base/java.lang=ALL-UNNAMED"
"--add-opens=java.base/java.util=ALL-UNNAMED"
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"]
Then, use the following code snippet in your source code to access the Datajure APIs:
(require '[datajure.dsl :as dtj])
For detailed information, refer to our documentation and try our examples.
In a New Project
If you wish to create a new Clojure project with Datajure as a dependency, you can to create the project simply from the Leiningen template using the following command:
lein new com.github.clojure-finance/datajure <project-name>
The templated project contains the latest Datajure with all other necessary dependencies, and also includes a simple example of data operation. To run the project, you can cd
into the project directory and do lein run
.
Using Datajure via the REPL
To use Datajure as a standalone REPL tool, you need to download the launcher based on the operating system you are using. The following table describes the launchers based on the operating system:
OS | Launcher |
---|---|
Linux / macOS | datajure |
Windows | datajure.ps1 |
The launcher downloads the latest release of Datajure REPL if it is not found and runs the Datajure REPL.
For Windows users, the launcher automatically checks and downloads the Windows Utilities for Hadoop to ensure that it runs smoothly.
Optionally, Linux users can install the Datajure launcher to /usr/local/bin
by running the following commands:
wget https://raw.githubusercontent.com/clojure-finance/datajure/main/scripts/datajure
chmod a+x datajure
sudo mv datajure /usr/local/bin/
Usage:
datajure [<path>] [--force-download] [--proxy <https-proxy>] [--help]
<path>
is an optional input file that should be a Datajure source file (.dtj
suffix).
For detailed information, refer to our documentation and try our examples.