Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ceyhunkerti/oracle_tocsv

oracle query to csv fast extraction utility
https://github.com/ceyhunkerti/oracle_tocsv

csv extraction oci odpi-c oracle zig

Last synced: 27 days ago
JSON representation

oracle query to csv fast extraction utility

Awesome Lists containing this project

README

        

# Oracle to CSV Extraction Utility

- Extracts data from an oracle query and outputs to csv.
- ~3.7x faster than a plugin based JDBC implementation. (with same parameters.)

## Build from source

You may need to setup instant client paths if you don't have it already.

- Download oracle instant client from [here](https://www.oracle.com/database/technologies/instant-client/downloads.html)
- Extract it to a path and set the `LD_LIBRARY_PATH`.
```sh
export LD_LIBRARY_PATH=/path/to/instantclient_[version]
```

- Install [zig](https://ziglang.org).

- You may need to install `libaio` required by oracle client.
```sh
sudo apt install libaio1
```

- todo: implement this in Makefile and remove Justfile.
- Download ODPI-C and place the extracted resources to `project-root/lib/odpi`

- Build the binary.
```sh
zig build -Doptimize=ReleaseFast
```

- See the binary `ox` at `zig-out/bin/`.

## Running

```sh
zig-out/bin/ox run \
# change below to actual connection string.
--connection-string "localhost:1521/ORCLCDB" \
--username oracle_username \
# optional (auth mode if you need SYSDBA)
--auth-mode SYSDBA \
--password oracle_password \
# You can use multi line strings see examples folder.
--sql "SELECT * FROM my_schema.my_table_name" \
# output-file can be an absolute path.
--output-file "output.csv" \
--fetch-size 10000
```

# todo
- Documentation
- Add benchmark results