All Projects → r3tex → CQLdriver.jl

r3tex / CQLdriver.jl

Licence: other
A Julia package for interfacing with CQL compliant databases.

Programming Languages

julia
2034 projects

Labels

Projects that are alternatives of or similar to CQLdriver.jl

cassandra-CQL-exporter
A highly configurable utility to export whole Apache Cassandra keyspace or table structure/data to CQL scripts.
Stars: ✭ 19 (+26.67%)
Mutual labels:  cql
book linuxkernel blockdrv
Learn how multi-queue block device in Linux kernel v4.4 works
Stars: ✭ 69 (+360%)
Mutual labels:  driver
dokan-delphi
Dokan Delphi Wrapper
Stars: ✭ 48 (+220%)
Mutual labels:  driver
Apex-Legends-SDK
Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified source engine as well as their Easy Anti Cheat Implementation.
Stars: ✭ 101 (+573.33%)
Mutual labels:  driver
neo4j-java-driver-spring-boot-starter
Automatic configuration of Neo4j's Java Driver for Spring Boot applications
Stars: ✭ 33 (+120%)
Mutual labels:  driver
gun-cassandra
Cassandra / Elassandra persistence layer for Gun DB 🔫
Stars: ✭ 14 (-6.67%)
Mutual labels:  cql
laravel-db2
laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.
Stars: ✭ 56 (+273.33%)
Mutual labels:  driver
pyderman
Install Selenium-compatible Chrome/Firefox/Opera/PhantomJS/Edge webdrivers automatically.
Stars: ✭ 24 (+60%)
Mutual labels:  driver
LowCDC-Win10x64
A lowcdc.sys driver package for Windows 10 x64. Supports AVR-CDC and Digispark devices.
Stars: ✭ 19 (+26.67%)
Mutual labels:  driver
fix-linux-mouse
Hints how to fix USB mouse issues on Linux
Stars: ✭ 36 (+140%)
Mutual labels:  driver
tarantool.ex
Tarantool client library for Elixir projects
Stars: ✭ 26 (+73.33%)
Mutual labels:  driver
pg async.rs
Asynchronous, HA (master-master) PostgreSQL driver on top of libpq.
Stars: ✭ 40 (+166.67%)
Mutual labels:  driver
AHRQ-CDS-Connect-Authoring-Tool
The CDS Authoring Tool is part of the CDS Connect project https://cds.ahrq.gov/, sponsored by the Agency for Healthcare Research and Quality (AHRQ), and developed under contract with AHRQ by MITRE's CAMH FFRDC.
Stars: ✭ 32 (+113.33%)
Mutual labels:  cql
vertica-sql-go
Official native Go client for the Vertica Analytics Database.
Stars: ✭ 52 (+246.67%)
Mutual labels:  driver
libwsk
The Kernel-Mode Winsock library, supporting TCP, UDP and Unix sockets (DGRAM and STREAM).
Stars: ✭ 117 (+680%)
Mutual labels:  driver
eruption
Realtime RGB LED Driver for Linux
Stars: ✭ 140 (+833.33%)
Mutual labels:  driver
pcd8544
Minimal footprint library for Philips PCD8544 LCDs on the Arduino.
Stars: ✭ 87 (+480%)
Mutual labels:  driver
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+400%)
Mutual labels:  driver
SimpleBLE
The ultimate fully-fledged cross-platform BLE library, designed for simplicity and ease of use.
Stars: ✭ 122 (+713.33%)
Mutual labels:  driver
ALSA-RAVENNA-AES67-Driver
RAVENNA AES-67 ALSA driver (a clone of the original provided by Merging Technologies)
Stars: ✭ 20 (+33.33%)
Mutual labels:  driver

CQLdriver

Build Status

This Julia package is an interface to ScyllaDB / Cassandra and is based on the Datastax CPP driver implementing the CQL v3 binary protocol. The package is missing very many features, but it does two things quite well:

  • write very many rows quickly
  • read very many rows quickly

Now, it's probably easy to extend this package to enable other features, but I haven't taken the time to do so. If you find this useful but are missing a small set of features I can probably implement them if you file an issue. CQLdriver is compatible and depends on DataFrames and JuliaDB.

Currently the following data-types are supported:

Julia Type CQL type
Vector{UInt8} BLOB
String TEXT
String VARCHAR
Date DATE
Int8 TINYINT
Int16 SMALLINT
Int32 INTEGER
Int64 BIGINT
Int64 COUNTER
Bool BOOLEAN
Float32 FLOAT
Float64 DOUBLE
DateTime TIMESTAMP
UUID UUID
UUID TIMEUUID

Example use

Starting / Closing a session

cqlinit() will return a tuple with 2 pointers and a UInt16 error code which you can check. If the returned value is 0 then you're in good shape. It also lets you tune some performance characteristics of your connection.

julia> session, cluster, err = cqlinit("192.168.1.128, 192.168.1.140")
julia> const CQL_OK = 0x0000
julia> @assert err == CQL_OK
julia> cqlclose(session, cluster)

julia> hosts = "192.168.1.128, 192.168.1.140"
julia> session, cluster, err = cqlinit(hosts, threads = 1, connections = 2, 
                                       queuesize = 4096, bytelimit = 65536, requestlimit = 256,
                                       username="admin", password="s3cr!t")
julia> cqlclose(session, cluster)

The driver tries to be smart about detecting all the nodes in the cluster and keeping the connection alive.

Writing data

cqlwrite() takes a DataFrame with named columns, or a JuliaDB table. Make sure that the column names in your DataFrame are the same as those in table you are writing to. By default it will write 1000 rows per batch and will make 5 attemps at writing each batch.

For appending new rows to tables:

julia> table = "data.refrigerator"
julia> data = DataFrame(veggies = ["Carrots", "Broccoli"], amount = [3, 5])
julia> err = cqlwrite(session, table, data)

For updating a table you must provide additional arguments. Consider the following statement which updates a table that uses counters: UPDATE data.car SET speed = speed + ?, temp = temp + ? WHERE partid = ? The query below is analogous to the statement above:

julia> table = "data.car"
julia> data = DataFrame(speed=[1,2], temp=[4,5], partid=["wheel1","wheel2"])
julia> err = cqlwrite(session, 
                      table, 
                      data[:,[:speed, :total]],
                      update = data[:,[:partid]],
                      batchsize = 10000,
                      retries = 6,
                      counter = true)

Reading data

cqlread() pulls down data in 10000-row pages by default. It will do 5 retries per page and collate everything into a DataFrame with typed and named columns.

julia> query = "SELECT * FROM data.car"
julia> err, output = cqlread(session, query)

(0x0000, 2×3 DataFrames.DataFrame
│ Row │ speed │ temp │ partid   │
├┼┼┼┤
│ 1   │ 1     │ 4    │ "wheel1" │
│ 2   │ 2     │ 5    │ "wheel2" │)

Changing the page size might affect performance. You can also increase the number of characters allowed for string types.

julia> query = "SELECT * FROM data.bigtable LIMIT 1000000"
julia> err, output = cqlread(session, 
                             query, 
                             pgsize = 15000, 
                             retries = 6, 
                             strlen = 1024)

You can send in an array of different queries and the driver will execute them asynchronously and return an array of resulting dataframes.

julia> query = ["SELECT * FROM data.bigtable WHERE driver=124","SELECT * FROM data.smalltable WHERE car=144"]
julia> err, output = cqlread(session, 
                             query, 
                             concurrency=500, 
                             timeout = 12000)

Executing commands

cqlexec() runs your command on the database and returns a 0x0000 if everything went OK.

julia> cmd = "CREATE TABLE test.example (id int, data text, PRIMARY KEY (id));"
julia> err = cqlexec(session, cmd)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].