RJDBC

OmniSci Core supports the R language using RJDBC.

Examples

Local Host Example

library(RJDBC)
drv <- JDBC("com.omnisci.jdbc.OmniSciDriver",
            "/home/omnisci/bin/omnisci-1.0-SNAPSHOT-jar-with-dependencies.jar",
            identifier.quote="'")
conn <- dbConnect(drv, "jdbc:omnisci:localhost:6274:mapd", "mapd", "HyperInteractive")
dbGetQuery(conn, "SELECT i1 FROM test1  LIMIT 11")
dbGetQuery(conn, "SELECT dep_timestamp FROM flights_2008_10k  LIMIT 11")

Remote Host Example

library(RJDBC)
drv <- JDBC("com.omnisci.jdbc.OmniSciDriver",
            "/home/omnisci/bin/omnisci-1.0-SNAPSHOT-jar-with-dependencies.jar",
            identifier.quote="'")
conn <- dbConnect(drv,
                  "jdbc:omnisci:colossus.omnisci.com:6274:mapd",
                  "mapd",
                  "HyperInteractive")
dbGetQuery(conn,
  paste("SELECT date_trunc(month, taxi_weather_tracts_factual.pickup_datetime)",
        "  as key0,",
        "AVG(CASE WHEN 'Hyatt' = ANY",
        "    taxi_weather_tracts_factual.dropoff_store_chains THEN 1 ELSE 0 END)",
        "  AS series_1",
        "FROM taxi_weather_tracts_factual",
        "WHERE (taxi_weather_tracts_factual.dropoff_merc_x >= -8254165.98668337",
        "  AND taxi_weather_tracts_factual.dropoff_merc_x < -8218688.304677745)",
        "AND (taxi_weather_tracts_factual.dropoff_merc_y >= 4966267.65475399",
        "  AND taxi_weather_tracts_factual.dropoff_merc_y < 4989291.122013792)",
        "AND (",
        "  taxi_weather_tracts_factual.pickup_datetime",
        "    >= TIMESTAMP(0) '2009-12-20 08:13:47'",
        "  AND taxi_weather_tracts_factual.pickup_datetime",
        "    < TIMESTAMP(0) '2015-12-31 23:59:59')",
        "GROUP BY key0 ORDER BY key0", sep=" "))