omnisci/omnisci-rs

A Rust client for connecting to OmniSciDB via its RPC protocol of Thrift

OmniSciDB via its RPC protocol of Cargo, using cargo build


A Rust client for connecting to OmniSciDB via its RPC protocol of Thrift. This package takes care of creating a client with the Thrift binary protocol and buffered transport, and exposes all of the OmniSci Thrift types and methods for use with it.

Requirements

This client has been tested on these versions, and is expected to work with more recent versions unless otherwise noted:

  • Rust 1.41+
  • OmniSciDB 5.1+

It is also likely to work on earlier versions of OmniSciDB, but this is not officially supported.

How to use

Add omnisci to your Cargo.toml:

[dependencies]
omnisci = "0.1.0"

Then create a client and connect (to the 'Backend TCP' port on the OmniSciDB instance):

use omnisci;

let mut client = omnisci::client::create("127.0.0.1:6274")?;

let user = "admin".to_string();
let passwd = "HyperInteractive".to_string();
let database = "omnisci".to_string();

let session = client.connect(user, passwd, database)?;

let query = "SELECT * FROM flights_donotmodify LIMIT 5".to_string();
let columnar = false;
let nonce = "1".to_string();
let first_n = 10000;
let at_most_n = -1;

let results = client.sql_execute(session, query, columnar, nonce, first_n, at_most_n);

See the examples folder for a more complete example.

Contributing

Building

This project is built with Cargo, using cargo build. Each file in src/ except for lib.rs is automatically generated using Thrift, based on the the Thrift definitions stored at omniscidb (mapd.thrift, plus the .thrift files it references via include). To regenerate them, install Thrift 0.13.0 with your system's package manager, clone omniscidb locally, and then run:

./generate_thrift_bindings.sh ../omniscidb

All source is also formatted with rustfmt, via cargo fmt.

Testing

The integration tests expect a local running instance of OmniSciDB on the default Backend TCP port: http://localhost:6274

If running natively (such as with the ./startomnisci script), that port is accessible by default. If running with Docker, expose the Backend TCP port in addition to the default Frontend Web port using -p 6274:6274.

When ready, run cargo test.

License

This project is licensed under the MIT license.

Issues

Collection of the latest Issues

darthseal

darthseal

Comment Icon0

Hey JraJav,

When trying to run query_print main.rs I only get integers, 0's and "NULL"

When I cargo run main.rs with only changing line 58 in main.rs to let query = "SELECT * FROM flights_2008_10k LIMIT 1".to_string(); and line 8 in Cargo.toml to omnisci = "0.1.0"

I get

If I run in Omnisql

Thank you,

Versions

Find the latest versions by id

Information - Updated May 04, 2022

Stars: 2
Forks: 2
Issues: 2

Rust port of my CHIP-8 Emulator (interpreted)

cargo run <path-to-ROM-file>

Rust port of my CHIP-8 Emulator (interpreted)

Runs embedded programs just like native ones

probe-run is a custom Cargo runner that transparently runs Rust firmware on a

Runs embedded programs just like native ones

Run cargo build to install all dependencies

Run cargo run to play the game

Run cargo build to install all dependencies

Simple Blockchain

cargo run para ejecutar la app, cargo build para crear un ejecutable

Simple Blockchain

A game in rust to learn rust and some opengl

Still cargo run to run executable, this main program watches over changes in

A game in rust to learn rust and some opengl

Light weight image library which focus on plotting!

type cargo run --example <example_name> in your terminal to see these example images crafted by our library

Light weight image library which focus on plotting!

little annoy is written in pure Rust

Run cargo run --example demo in your terminal

little annoy is written in pure Rust

secure password generator

cargo run [word count] [number count]

secure password generator

Tiny Renderer

cargo run --release texture static/earth

Tiny Renderer

Modor is a modular and kind of object-oriented game engine

Web: cargo run-wasm --example <name> --release

Modor is a modular and kind of object-oriented game engine

This repo will contian some basic rust projects along with Bevy 2D game as well

cargo run if you download the whole the repo

This repo will contian some basic rust projects along with Bevy 2D game as well
Facebook Instagram Twitter GitHub Dribbble
Privacy