Showing posts with label Big Data. Show all posts
Showing posts with label Big Data. Show all posts

Sunday, April 17, 2016

beeline Error: Could not open client transport with JDBC Uri

Introduction

Are you receiving the Connection refused  error (or)  Error: Could not open client transport with JDBC Uri when you try to start the beeline command prompt as part of the Cloudera distribution for Apache Hadoop (CDH) ?

beeline –u jdbc:hive2://localhost:10000

Though the above syntax should work without any problem, this issue still exists in the Cloudera Quickstart VM 5.5 version.

Solution

Just put a  /  at the end of the syntax and the issue goes away. It is an easy solution.  So please try to start beeline with the beeline –u jdbc:hive2://localhost:10000/ syntax

Friday, July 31, 2015

How to format a json file

Introduction

JSON or JavaScript Object Notation is an open standard format that uses human-readable text to transmit data objects in the form of attribute-value pairs (also referred as key/value paris). It is now considered an alternative to XML for transmitting data between a server and an application.

It is platform independent and code for parsing and generating JSON documents is available in many programming languages. Furthermore, it enjoys a lot of popularity among developers in building data sets accessed through APIs (Application Programming Interfaces). Popular examples include the Twitter API and Yelp.com API. The official Internet media type for JSON is application/json. The JSON filename extension is .json.

Problem

The Yelp.com academic data sets are available in JSON format. One can download the data sets by visiting the web page https://www.yelp.com/dataset_challenge/dataset

The file downloaded is yelp_dataset_challenge_academic_dataset.tgz. Once the contents are extracted using tar -xvf yelp_dataset_challenge_academic_dataset.tgz command, the individual .json files are available for use. 

They include yelp_academic_dataset_business.jsonyelp_academic_dataset_review.json and yelp_academic_dataset_tip.json etc. Each json file contains several hundreds of json data objects, one per line. Because the key, value pairs in each of these json data objects is not indented well, it becomes tough to comprehend keys that are nested or keys that have an array of values or a combination of both. 

For example, the first JSON data object (first line) of the file yelp_academic_dataset_business.json  is stored as 

"business_id": "vcNAWiLM4dR7D2nwwJ7nCA", "full_address": "4840 E Indian School Rd\nSte 101\nPhoenix, AZ 85018", "hours": {"Tuesday": {"close": "17:00", "open": "08:00"}, "Friday": {"close": "17:00", "open": "08:00"}, "Monday": {"close": "17:00", "open": "08:00"}, "Wednesday": {"close": "17:00", "open": "08:00"}, "Thursday": {"close": "17:00", "open": "08:00"}}, "open": true, "categories": ["Doctors", "Health & Medical"], "city": "Phoenix", "review_count": 9, "name": "Eric Goldberg, MD", "neighborhoods": [], "longitude": -111.98375799999999, "state": "AZ", "stars": 3.5, "latitude": 33.499313000000001, "attributes": {"By Appointment Only": true}, "type": "business"}

A well indented JSON data object should be similar to the example in Code Listing 1 in the article http://www.oracle.com/technetwork/issue-archive/2015/15-jan/o15dba-2372211.html

Solution

1) Extract the first JSON data object in the file yelp_academic_dataset_business.json  and store it separately in business.json

2) Now run the command

cat business.json | python -m json.tool > business_one_json_document.json


3) The business_one_json_document.json file now contains the JSON data object with indented key/value pairs and therefore more readable.

{
    "attributes": {
        "By Appointment Only": true
    },
    "business_id": "vcNAWiLM4dR7D2nwwJ7nCA",
    "categories": [
        "Doctors",
        "Health & Medical"
    ],
    "city": "Phoenix",
    "full_address": "4840 E Indian School Rd\nSte 101\nPhoenix, AZ 85018",
    "hours": {
        "Friday": {
            "close": "17:00",
            "open": "08:00"
        },
        "Monday": {
            "close": "17:00",
            "open": "08:00"
        },
        "Thursday": {
            "close": "17:00",
            "open": "08:00"
       },
        "Tuesday": {
            "close": "17:00",
            "open": "08:00"
        },
        "Wednesday": {
            "close": "17:00",
            "open": "08:00"
        }
    },
    "latitude": 33.499313000000001,
    "longitude": -111.98375799999999,
    "name": "Eric Goldberg, MD",
    "neighborhoods": [],
    "open": true,
    "review_count": 9,
    "stars": 3.5,
    "state": "AZ",
    "type": "business"
}


Saturday, February 14, 2015

Learn SQL Language to work with Big Data in Hadoop

Introduction

SQL (Structured Query Language) is the most widely used language to read and write data in relational databases such as Oracle, MS SQL Server and MySQL databases etc. SQL language existed since the 1970's and is also a standard of the American National Standards Institute (ANSI).

Because of most of the traditional databases such as corporate internal databases and customer facing databases such as those driving retail websites use the relational database model, SQL language skills has become a mandatory skill for Information Technology (IT) staff such as developers, analysts, database administrators and even software QA engineers, project managers and IT auditors etc.

Big Data

Apache Hadoop, which is the most popular framework for storing and processing Big Data, has a related sub project component called Apache Hive. Initially developed by Facebook Inc. and later open sourced, Apache Hive provides a data warehouse solution on top of Hadoop. It provides a relational database abstraction for Hadoop's Big Data (though Hadoop's databases are not relational databases). Of particular note is the HiveQL (SQL like language to query and analyze Hadoop's data) . If one already is an SQL language expert, learning HiveQL is very easy and helps a traditional (relational database) user work with most of Hadoop's Big Data easily.

Apache HCatalog extends  Hive (now since merged with Hive in 2013) by publishing a RESTful interface so that even external systems can access the Hive metadata using RESTful methods. Most of the popular distributions of Hadoop include the Hive component as well (now HCatalog) such as the HortonWorks Data Platform (HDP).  IBM's Hadoop distribution BigInsights has a similar component called as BigSQL.  Per IBM's blog, BigSQL is an enterprise-class SQL query engine and has better ANSI SQL support than HiveQL.

DBA University's Oracle SQL PL/SQL Training course

DBA University has a comprehensive Oracle SQL PL/SQL Training course and we encourage you to register for it if you don't have at least an intermediate level knowledge in SQL and PL/SQL.  It is a very detail oriented training course with remote lab server access for each student for practicing the SQL and PL/SQL lab exercises.


Classes :Sun,Mon,Tue,Wed   evenings
Duration: 7 to 8 weeks approximately.
Lab Work: Remote lab server access for each student.

This online course will cover Relational Database Design, Oracle SQL Language and PL/SQL programming topics. 


a) Week 1     - Relational Database Design and software installations. 
b) Week 2,3,4 - Oracle SQL Language. 
c) Week 5,6,7 - Oracle PL/SQL Language. 
d) Week 8     - Final week to catch up any remaining topics.