Coder Social home page Coder Social logo

educkdb's Introduction

educkdb

Hex.pm version Hex.pm downloads

Build disabled, github's vms are too small to build duckdb amalgation build
[![Test](https://github.com/mmzeeman/educkdb/actions/workflows/test.yml/badge.svg)](https://github.com/mmzeeman/educkdb/actions/workflows/test.yml)

DuckDB NIF for Erlang.

DuckDB (https://duckdb.org/) is an in-process SQL OLAP database management system. This library makes it possible to use DuckDB in Erlang, Elixir or other languages supported by the beam.

Example

Connect to a database

{ok, Db} = educkdb:open("database.db"),
{ok, Conn} = educkdb:connect(Db)
...

Create a table by reading a CSV or parquet files.

{ok, _} = educkdb:query(Conn, "CREATE TABLE ontime AS SELECT * FROM 'test.csv'"),
{ok, ParquetData} = educkdb:query(Conn, "SELECT * FROM 'test.parquet'"),
...

API

Note: This is a work in progress. At the moment it is possible to open, connect, query and return integer and varchar results. The nif function returning the query result will become a yielding nif. This is important for large query results.

Startup

open(filename, options) -> {ok, DB} | {error, msg}

Note: (dirty scheduler)

connect(db) -> {ok, Conn} | {error, msg}

Note, creates a nif thread with a command queue, all calls which uses the connection as parameter will be send to the thread via the queue.

disconnect(connection) -> ok | {error, msg}

Note: via command thread.

Explicitly disconnect the connection. This also explicitly finalizes the thread. It is not required to call this. The garbage collector will disconnection automatically.

close(db) -> ok | {error, msg}

Note: (dirty scheduler)

Explicitly close the db. It is not required to call this. The garbage collector will disconnection automatically.

Querying

query(Conn, Query) -> {ok, QueryResult} | {error, msg}

Note: dirty scheduler

Run a query, return the result.

Prepared Statements

prepare(Conn, Query) -> {ok, Stmt} | {error, _}

Note: dirty scheduler

bind(Stmt, Values) -> ok | {error, _}

Note: direct c

bind_null(Stmt, Index, Value) -> ok | error

Note: direct c

bind_boolean(Stmt, Index, Value) -> ok | error

Note: direct c

bind_int8(Stmt, Index, Value) -> ok | error

Note: direct c

bind_int16(Stmt, Index, Value) -> ok | error

Note: direct c

bind_int32(Stmt, Index, Value) -> ok | error

Note: direct c

bind_int64(Stmt, Index, Value) -> ok | error

Note: direct c

bind_hugeint(Stmt, Index, Value) -> ok | error

Note: direct c

bind_uint8(Stmt, Index, Value) -> ok | error

Note: direct c

bind_uint16(Stmt, Index, Value) -> ok | error

Note: direct c

bind_uint32(Stmt, Index, Value) -> ok | error

Note: direct c

bind_uint64(Stmt, Index, Value) -> ok | error

Note: direct c

bind_float(Stmt, Index, Value) -> ok | error

Note: direct c

bind_double(Stmt, Index, Value) -> ok | error

Note: direct c

bind_date(Stmt, Index, Value) -> ok | error

Note: direct c

bind_time(Stmt, Index, Value) -> ok | error

Note: direct c

bind_timestamp(Stmt, Index, Value) -> ok | error

Note: direct c

....more

execute_statement(Stmt) -> {ok, result()} | {error, _}

Note: dirty thread

appender

Implementation notes

educkdb's People

Contributors

mmzeeman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zabrane

educkdb's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.