Giter Club home page Giter Club logo

gcp-cloud-sql-loading-taxi-data's Introduction

Loading Taxi Data into Google Cloud SQL

Overview

This project focuses on loading data from a CSV file in a Google Cloud Storage bucket into a cloud SQL instance

Data Source: NYC Taxi and Limousine Commission.

Dataset description: Includes trip records from all trips completed in Yellow and Green taxis in NYC from 2009 to present, and all trips in for-hire vehicles (FHV) from 2015 to present. Records include fields capturing pick-up and drop-off dates/times, pick-up and drop-off locations, trip distances, itemized fares, rate types, payment types, and driver-reported passenger counts.

Objectives

Create Cloud SQL instance

Create a Cloud SQL database

Import text data into Cloud SQL

Check the data for integrity

Steps

Create environment variables that will be used later for your project ID and the storage bucket that will contain your data: export PROJECT_ID=$(gcloud info --format='value(config.project)') export BUCKET=${PROJECT_ID}-ml

Create a Cloud SQL instance gcloud sql instances create taxi
--tier=db-n1-standard-1 --activation-policy=ALWAYS

Set a root password for the Cloud SQL instance: gcloud sql users set-password root --host % --instance taxi
--password Passw0rd

create an environment variable with the IP address of the Cloud Shell: export ADDRESS=$(wget -qO - http://ipecho.net/plain)/32

Whitelist the Cloud Shell instance for management access to your SQL instance: gcloud sql instances patch taxi --authorized-networks $ADDRESS

Get the IP address of your Cloud SQL instance by running:

>MYSQLIP=$(gcloud sql instances describe \
>taxi --format="value(ipAddresses.ipAddress)")

Check the variable MYSQLIP: >echo $MYSQLIP

Create the taxi trips table by logging into the mysql command line interface:

>mysql --host=$MYSQLIP --user=root \
    >--password --verbose

When prompted for a password enter Passw0rd.

Paste the Code in Section 1 of the SQL file into the command line to create the schema for the trips table:

gcp-cloud-sql-loading-taxi-data's People

Contributors

zadmainda avatar

Watchers

 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.