Hands on Google Cloud SQL and Cloud Spanner Deployment, Administration and Use Cases with Python

Hands on Google Cloud SQL and Cloud Spanner Deployment, Administration and Use Cases with Python

Hands On Google Cloud SQL and Cloud Spanner Deployment, Administration and Use Cases with Python Navin Sabharwal Shakuntala Gupta Edward Hands On Google Cloud SQL and Cloud Spanner Navin Sabharwal Shakuntala Gupta Edward New Delhi, India Ghaziabad, India ISBN-13 (pbk): 978-1-4842-5536-0 ISBN-13 (electronic): 978-1-4842-5537-7 https://doi.org/10.1007/978-1-4842-5537-7 Copyright © 2020 by Navin Sabharwal, Shakuntala Gupta Edward This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Celestin Suresh John Development Editor: Siddhi Chavan Coordinating Editor: Aditee Mirashi Cover designed by eStudioCalamar Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer- sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected], or visit http://www.apress.com/ rights-permissions. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-5536-0. For more detailed information, please visit http://www.apress.com/source-code. Printed on acid-free paper Dedicated to the people I love and the God I trust. —Navin Sabharwal Dedicated to my family for being my rock and guiding light and to my God who shades every step of my life. —Shakuntala Gupta Edward Table of Contents About the Authors .................................................................................................... ix About the Technical Reviewer ................................................................................. xi Acknowledgments ................................................................................................. xiii Introduction .............................................................................................................xv Chapter 1: Getting Started with GCP ......................................................................... 1 Signing Up ..................................................................................................................................... 3 Accessing Google Cloud Platform ................................................................................................. 6 Cloud Console .......................................................................................................................... 7 Cloud Shell ............................................................................................................................ 10 Cloud SDK .............................................................................................................................. 18 Project ......................................................................................................................................... 18 Ownership: Projects and Billing ............................................................................................. 19 Projects and Isolations .......................................................................................................... 20 Project as Namespace ........................................................................................................... 20 Create a Project ..................................................................................................................... 23 Summary..................................................................................................................................... 26 Chapter 2: Cloud SQL .............................................................................................. 27 Relational Databases .................................................................................................................. 27 Primary Key ........................................................................................................................... 29 Foreign Key ............................................................................................................................ 29 Constraints ............................................................................................................................ 30 Operations ............................................................................................................................. 31 Getting Started with Cloud SQL ................................................................................................... 36 Provision a MySQL Instance ........................................................................................................ 37 v TABLE OF CONTENTS Provisioning a PostgreSQL Instance ........................................................................................... 50 Summary..................................................................................................................................... 55 Chapter 3: Working with CloudSQL ......................................................................... 57 Getting Started in Cloud Shell ..................................................................................................... 57 Connect to the Database ....................................................................................................... 58 Create Database .................................................................................................................... 60 Create Table ........................................................................................................................... 61 Insert and Select ................................................................................................................... 62 Load and Query Sample Dataset ........................................................................................... 63 Python Program - Feast Out ........................................................................................................ 77 Database Schema .................................................................................................................. 78 Provision Compute Instance .................................................................................................. 82 Set Up Python Development Environment ............................................................................. 86 Enable APIs ............................................................................................................................ 87 Create Service Account ......................................................................................................... 90 Install and Configure Cloud SDK ............................................................................................ 94 Python Program ................................................................................................................... 103 Run and Verify ..................................................................................................................... 113 Wrap Up .................................................................................................................................... 126 Summary................................................................................................................................... 128 Chapter 4: Administering CloudSQL...................................................................... 129 Authorization and Security ........................................................................................................ 132 Authorized Network ............................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us