Giter Site home page Giter Site logo

spark-jdbc's Introduction

Spark SQL JDBC Library

A library for parsing and querying JDBC data with Spark SQL.

Requirements

This library requires Spark 1.2+

The spark-jdbc assembly jar file can also be added to a Spark using the --jars command line option. For example, to include it when starting the spark shell:

$ bin/spark-sql --jars spark-jdbc_2.10-0.1.jar
CREATE TEMPORARY TABLE jdbc_table
USING com.luogankun.spark.jdbc
OPTIONS (
url    'jdbc:mysql://hadoop000:3306/hive',
user    'root',
password    'root',
sql 'select TBL_ID,TBL_NAME,TBL_TYPE FROM TBLS'
);

SELECT * FROM jdbc_table;
CREATE TEMPORARY TABLE jdbc_table
USING com.luogankun.spark.jdbc
OPTIONS (
url    'jdbc:oracle:thin:@hadoop000:1521/ora11g',
user    'coc',
password    'coc',
sql 'select HISTORY_ID, APPROVE_ROLE_ID, APPROVE_OPINION from CI_APPROVE_HISTORY'
);

SELECT * FROM jdbc_table;
CREATE TEMPORARY TABLE jdbc_table
USING com.luogankun.spark.jdbc
OPTIONS (
url    'jdbc:db2://hadoop000:60000/CI',
user    'ci',
password    'ci',
sql 'select LABEL_ID from coc.CI_LABEL_EXT_INFO'
);

SELECT * FROM jdbc_table;

Building From Source

This library is built with SBT, which is automatically downloaded by the included shell script. To build a JAR file simply run sbt/sbt assembly from the project root.

Support Database: Mysql&Oracle&DB2 Support DataType: string&int&long&timestamp&date

spark-jdbc's People

Contributors

luogankun avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.