View Source educkdb (educkdb v0.9.10)
Summary
Types
struct, making up a 128 bit signed integer.
DuckDB index type
DuckDB tinyint
DuckDB shortint
DuckDB integer
DuckDB bigint
In the range 0.0..60.0
Note: decimal, timestamp_s, timestamp_ms, timestamp_ns and interval's are not supported yet.
struct, making up a 128 bit unsigned integer.
DuckDB duckdb utinyint
DuckDB ushortint
DuckDB uinteger
DuckDB ubigint
Functions
Append a boolean value to the current location in the row.
Append a data to the current location in the row.
Append a double to the current location in the row. Note: duckdb double's are the same as erlang floats.
Append a float to the current location in the row. Note: duckdb floats are different than erlang floats. When you add an erlang float to a duckdb float column, you will loose precision.
Append a tinyint to the current location in the row.
Append a smallint to the current location in the row.
Append an integer (32 bit) to the current location in the row.
Append a bigint to the current location in the row.
Append a null value to the current location in the row.
Append a time to the current location in the row.
Append a timestamp to the current location in the row.
Append a utinyint to the current location in the row.
Append a usmallint to the current location in the row.
Append an unsigned integer (32 bit) to the current location in the row.
Append a ubigint to the current location in the row.
Append a varchar to the current location in the row.
Create an appender. Appenders allow for high speed bulk insertions into the database. See DuckDB Appender for more information.
Finalize the current row, and start a new one.
Flush the appender to the table, forcing the cache of the appender to be cleared and the data to be appended to the base table.
Bind a boolean to the prepared statement at the specified index.
Bind a date to the prepared statement at the specified index. The date can be either given as a calendar:date() tuple, or an integer with the number of days since the first of January in the year 0.
Bind an uint64 to the prepared statement at the specified index. Note: Erlang's float datatype is a DuckDB double. Using this function allows you to keep the precision.
Bind an float to the prepared statement at the specified index. Note: Erlang's float() datatype is actually a DuckDB double. When binding an Erlang float variable you will lose precision.
Bind an int8 to the prepared statement at the specified index.
Bind an int16 to the prepared statement at the specified index.
Bind an int32 to the prepared statement at the specified index.
Bind an int64 to the prepared statement at the specified index.
Bind a null value to the prepared statement at the specified index.
Bind a time to the prepared statement at the specified index. The time can be either given as an {hour, minute, second} tuple (similar to calendar:time()), or as an integer with the number of microseconds since midnight.
Bind a timestamp to the prepared statement at the specified index. The timestamp can be either a datetime tuple, or an integer with the microseconds since 1-Jan in the year 0.
Bind an uint8 to the prepared statement at the specified index.
Bind an uint8 to the prepared statement at the specified index.
Bind an uint32 to the prepared statement at the specified index.
Bind an uint64 to the prepared statement at the specified index.
Bind a iolist as varchar to the prepared statement at the specified index. Note: This function is meant to bind null terminated strings in the database. Not arbitrary binary data.
Return the number of columns in the data chunk.
Get the column types of the chunk [todo] spec..
Get the columns data of the chunk [todo] spec
Return the number of tuples in th data chunk.
Return the parameter type of the prepared statement at the specified index.
Close the database. All open connections will become unusable.
Get the column names from the query result.
Return a map with config flags, and explanations. The options can vary depending on the underlying DuckDB version used. For more information about DuckDB configuration options, see: DuckDB Configuration.
Connect to the database. Note: It is adviced to use the connection in a single process.
Disconnect from the database.
Execute a prepared statement, and retrieve the first result from the first data chunk.
Execute a prepared statement. The answer is returned.
Fetches a data chunk from a result. The function should be called repeatedly until the result is exhausted.
Get all data chunks from a query result.
Convert a duckdb hugeint record to an erlang integer.
Convert an erlang integer to a DuckDB hugeint.
Open, or create a duckdb database with default options.
Open, or create a duckdb file
Return the number of parameters in a prepared statement.
Return the parameter name of the prepared statement at the specified index.
Return the parameter type of the prepared statement at the specified index.
Compile, and prepare a statement for later execution.
Query the database. The answer the answer is returned immediately.
Do a simple sql query without parameters, and retrieve the result from the first data chunk.
Return the statement type of a prepared statement.
Convert a duckdb uhugeint record to an erlang integer.
Convert a binary represented UUID to a printable hex representation.
Convert a printable UUID to a binary representation.
Types
-type append_response() :: ok | {error, _}.
-type appender() :: reference().
-type bind_response() :: ok | {error, _}.
-type connection() :: reference().
-type data_chunk() :: reference().
-type database() :: reference().
-type datetime() :: {calendar:date(), time()}.
-type hugeint() :: #hugeint{}.
-type idx() :: uint64().
-type int8() :: -127..127.
-type int16() :: -32767..32767.
-type int32() :: -2147483647..2147483647.
-type int64() :: -9223372036854775807..9223372036854775807.
-type prepared_statement() :: reference().
-type result() :: reference().
-type second() :: calendar:time() | float().
-type sql() :: iodata().
-type statement_type() ::
invalid | select | insert | update | explain | delete | prepare | create | execute | alter |
transaction | copy | analyze | variable_set | create_func | drop | export | pragma | vacuum |
call | set | load | relation | extension | logical_plan | attach | detach | multi | unknown.
-type time() :: {calendar:hour(), calendar:minute(), second()}.
-type type_name() ::
boolean | tinyint | smallint | integer | bigint | utinyint | usmallint | uinteger | ubigint |
float | double | hugeint | uhugeint | timestamp | date | time | interval | varchar | blob |
decimal | timestamp_s | timestamp_ms | timestamp_ns | enum | interval | list | struct | map |
uuid | json.
-type uhugeint() :: #uhugeint{}.
-type uint8() :: 0..255.
-type uint16() :: 0..65535.
-type uint32() :: 0..4294967295.
-type uint64() :: 0..18446744073709551615.
Functions
-spec append_boolean(Appender, Boolean) -> AppendResponse when Appender :: appender(), Boolean :: boolean(), AppendResponse :: append_response().
-spec append_date(Appender, Date) -> AppendResponse when Appender :: appender(), Date :: calendar:date() | integer(), AppendResponse :: append_response().
-spec append_double(Appender, Double) -> AppendResponse when Appender :: appender(), Double :: float(), AppendResponse :: append_response().
-spec append_float(Appender, Float) -> AppendResponse when Appender :: appender(), Float :: float(), AppendResponse :: append_response().
-spec append_int8(Appender, TinyInt) -> AppendResponse when Appender :: appender(), TinyInt :: int8(), AppendResponse :: append_response().
-spec append_int16(Appender, SmallInt) -> AppendResponse when Appender :: appender(), SmallInt :: int16(), AppendResponse :: append_response().
-spec append_int32(Appender, Integer) -> AppendResponse when Appender :: appender(), Integer :: int32(), AppendResponse :: append_response().
-spec append_int64(Appender, BigInt) -> AppendResponse when Appender :: appender(), BigInt :: int64(), AppendResponse :: append_response().
-spec append_null(Appender) -> AppendResponse when Appender :: appender(), AppendResponse :: append_response().
-spec append_time(Appender, Time) -> AppendResponse when Appender :: appender(), Time :: calendar:time() | time() | non_neg_integer(), AppendResponse :: append_response().
-spec append_timestamp(Appender, Timestamp) -> AppendResponse when Appender :: appender(), Timestamp :: calendar:datetime() | erlang:timestamp() | datetime() | integer(), AppendResponse :: append_response().
-spec append_uint8(Appender, UTinyInt) -> AppendResponse when Appender :: appender(), UTinyInt :: uint8(), AppendResponse :: append_response().
-spec append_uint16(Appender, USmallInt) -> AppendResponse when Appender :: appender(), USmallInt :: uint16(), AppendResponse :: append_response().
-spec append_uint32(Appender, UInteger) -> AppendResponse when Appender :: appender(), UInteger :: uint32(), AppendResponse :: append_response().
-spec append_uint64(Appender, UBigInt) -> AppendResponse when Appender :: appender(), UBigInt :: uint64(), AppendResponse :: append_response().
-spec append_varchar(Appender, IOData) -> AppendResponse when Appender :: appender(), IOData :: iodata(), AppendResponse :: append_response().
-spec appender_create(Connection, Schema, Table) -> Result when Connection :: connection(), Schema :: undefined | binary(), Table :: binary, Result :: {ok, appender()} | {error, _}.
-spec appender_end_row(Appender) -> AppendResponse when Appender :: appender(), AppendResponse :: append_response().
-spec appender_flush(Appender) -> AppendResult when Appender :: appender(), AppendResult :: append_response().
-spec bind_boolean(PreparedStatement, Index, Boolean) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Boolean :: boolean(), BindResponse :: bind_response().
-spec bind_date(PreparedStatement, Index, Date) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Date :: calendar:date() | integer(), BindResponse :: bind_response().
-spec bind_double(PreparedStatement, Index, Double) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Double :: float(), BindResponse :: bind_response().
-spec bind_float(PreparedStatement, Index, Float) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Float :: float(), BindResponse :: bind_response().
-spec bind_int8(PreparedStatement, Index, Int8) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Int8 :: int8(), BindResponse :: bind_response().
-spec bind_int16(PreparedStatement, Index, Int16) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Int16 :: int16(), BindResponse :: bind_response().
-spec bind_int32(PreparedStatement, Index, Int32) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Int32 :: int32(), BindResponse :: bind_response().
-spec bind_int64(PreparedStatement, Index, Int64) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Int64 :: int64(), BindResponse :: bind_response().
-spec bind_null(PreparedStatement, Index) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), BindResponse :: bind_response().
-spec bind_time(PreparedStatement, Index, Time) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), Time :: calendar:time() | time() | non_neg_integer(), BindResponse :: bind_response().
-spec bind_timestamp(PreparedStatement, Index, TimeStamp) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), TimeStamp :: calendar:datetime() | datetime() | integer(), BindResponse :: bind_response().
-spec bind_uint8(PreparedStatement, Index, UInt8) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), UInt8 :: uint8(), BindResponse :: bind_response().
-spec bind_uint16(PreparedStatement, Index, UInt16) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), UInt16 :: uint16(), BindResponse :: bind_response().
-spec bind_uint32(PreparedStatement, Index, UInt32) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), UInt32 :: uint32(), BindResponse :: bind_response().
-spec bind_uint64(PreparedStatement, Index, UInt64) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), UInt64 :: uint64(), BindResponse :: bind_response().
-spec bind_varchar(PreparedStatement, Index, IOData) -> BindResponse when PreparedStatement :: prepared_statement(), Index :: idx(), IOData :: iodata(), BindResponse :: bind_response().
-spec chunk_column_count(DataChunk) -> ColumnCount when DataChunk :: data_chunk(), ColumnCount :: uint64().
-spec chunk_size(DataChunk) -> TupleCount when DataChunk :: data_chunk(), TupleCount :: uint64().
-spec clear_bindings(PreparedStatement) -> ok | error when PreparedStatement :: prepared_statement().
-spec close(Database) -> Result when Database :: database(), Result :: ok | {error, _}.
-spec column_names(QueryResult) -> Names when QueryResult :: result(), Names :: [binary()].
-spec config_flag_info() -> map().
-spec connect(Database) -> Result when Database :: database(), Result :: {ok, connection()} | {error, _}.
-spec disconnect(Connection) -> Result when Connection :: connection(), Result :: ok | {error, _}.
-spec execute(PreparedStatement) -> Result when PreparedStatement :: prepared_statement(), Result :: {ok, [named_column()]} | {error, _}.
-spec execute_prepared(PreparedStatement) -> Result when PreparedStatement :: prepared_statement(), Result :: {ok, result()} | {error, _}.
-spec fetch_chunk(QueryResult) -> DataChunk | '$end' when QueryResult :: result(), DataChunk :: data_chunk().
-spec get_chunks(QueryResult) -> DataChunks when QueryResult :: result(), DataChunks :: [data_chunk()].
-spec hugeint_to_integer(Hugeint) -> Integer when Hugeint :: hugeint(), Integer :: integer().
-spec integer_to_hugeint(Integer) -> Hugeint when Integer :: integer(), Hugeint :: hugeint().
Convert an erlang integer to a DuckDB hugeint.
For more information on DuckDB numeric types: See DuckDB Numeric Data Types.-spec integer_to_uhugeint(NonNegInteger) -> UHugeint when NonNegInteger :: non_neg_integer(), UHugeint :: uhugeint().
-spec open(Filename) -> Result when Filename :: string(), Result :: {ok, database()} | {error, _}.
-spec open(Filename, Options) -> Result when Filename :: string(), Options :: map(), Result :: {ok, database()} | {error, _}.
-spec parameter_count(PreparedStatement) -> non_neg_integer() when PreparedStatement :: prepared_statement().
-spec parameter_index(PreparedStatement, Name) -> non_neg_integer() when PreparedStatement :: prepared_statement(), Name :: atom() | binary().
-spec parameter_name(PreparedStatement, Index) -> ParameterName when PreparedStatement :: prepared_statement(), Index :: idx(), ParameterName :: binary().
-spec parameter_type(PreparedStatement, Index) -> ParameterType when PreparedStatement :: prepared_statement(), Index :: idx(), ParameterType :: type_name().
-spec prepare(connection(), sql()) -> {ok, prepared_statement()} | {error, _}.
-spec query(Connection, Sql) -> Result when Connection :: connection(), Sql :: sql(), Result :: {ok, result()} | {error, _}.
-spec squery(Connection, Sql) -> Result when Connection :: connection(), Sql :: sql(), Result :: {ok, [named_column()]} | {error, _}.
-spec statement_type(PreparedStatement) -> Result when PreparedStatement :: prepared_statement(), Result :: statement_type().
-spec uhugeint_to_integer(UHugeint) -> Integer when UHugeint :: uhugeint(), Integer :: integer().