ODBC

An ODBC interface for the Julia programming language


Keywords
database, julia, odbc
License
Other

Documentation

ODBC.jl

ODBC ODBC

Linux: Build Status

Windows: Build Status

An ODBC interface for the Julia programming language

Installation through the Julia package manager:

julia> Pkg.init()        # Creates julia package repository (only runs once for all packages)
julia> Pkg.add("ODBC")   # Creates the ODBC repo folder and downloads the ODBC package + dependancy (if needed)
julia> using ODBC        # Loads the ODBC module for use (needs to be run with each new Julia instance)

Basic Usage:

using DataFrames
using ODBC

# list installed ODBC drivers
ODBC.listdrivers()
# list pre-defined ODBC DSNs
ODBC.listdsns()

# connect to a DSN using a pre-defined DSN or custom connection string
dsn = ODBC.DSN("pre_defined_DSN","username","password")

# Basic a basic query that returns results at a Data.Table by default
datatable = ODBC.query(dsn, "show databases")

# convert result to a DataFrame for additional data manipulation functionality
df = DataFrame(datatable)
# ... additional data processing ...

# Execute a query without returning results
ODBC.execute!(dsn, "use mydb")

# return query results as a CSV file
csv = CSV.Sink("mydb_tables.csv")
data = ODBC.query(dsn, "select table_name from information_schema.tables", csv);

# return query results in an SQLite table
db = SQLite.DB()
source = ODBC.Source(dsn, "select table_name from information_schema.tables")
sqlite = SQLite.Sink(source, db)
Data.stream!(source, sqlite)

Use the automatic help mode for more information on package types/functions.