Code Monkey home page Code Monkey logo

ibm-cloud / cloud-sql-database Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 19.0 43 KB

Code for a tutorial on how to provision an SQL (relational) database on the IBM Cloud, load data and use it with a Python (Flask / Jinja) web app.

Home Page: https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-sql-database

License: Apache License 2.0

CSS 14.87% HTML 36.73% Python 32.08% Dockerfile 16.31%
cloud-database sql-database ibm-cloud ibm-db2 db2-warehouse python ibm-cloud-solutions ibm-cloud-cr

cloud-sql-database's Introduction

Note: A former version of the tutorial deployed the app to Cloud Foundry Public on IBM Cloud. You can find the material in the branch cloudfoundry.

IBM Cloud SQL Database

This tutorial shows how to provision a SQL (relational) database service, create a table and load a larger data set, city information into the database. Thereafter, we deploy a web app "worldcities" to make use of that data and show how to access the cloud database. The app is written in Python using the Flask framework.

This tutorial is part of IBM Cloud tutorials and discussed as SQL Database for Cloud Data.

architecture diagram

Up and running in few steps

To get this SQL database-backed app up and running only few steps and about 10 minutes are needed. Please follow the steps outlined in the IBM Cloud tutorial.

To build your own container image and use it for the app, there different options available.

Local testing

  • Install the requirements to run Python directly or build and run the container image.
  • Set the environment variable DASHDB_SSLDSN to the value obtained from the Db2 Warehouse credentials for the key ssldsn.

Feedback

If you have feedback on the code or the related tutorial, please open an issue on this repository.

cloud-sql-database's People

Contributors

data-henrik avatar dependabot[bot] avatar dprosper avatar funmikesa avatar powellquiring avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cloud-sql-database's Issues

hi getting this issue when pushing the app to bluemix

TIP: use 'cf logs worldcities --recent' for more information
FAILED

2018-06-05T19:13:57.90-0500 [APP/PROC/WEB/0] ERR Traceback (most recent call last):
2018-06-05T19:13:57.92-0500 [APP/PROC/WEB/0] ERR File "worldcities.py", line 19, in
2018-06-05T19:13:57.92-0500 [APP/PROC/WEB/0] ERR db2info = json.loads(os.environ['VCAP_SERVICES'])['dashDB'][0]
2018-06-05T19:13:57.92-0500 [APP/PROC/WEB/0] ERR KeyError: 'dashDB'

Need to clarify that the VCAP_SERVICES is different for DB2 Warehouse on Cloud and Db2 on Cloud services.

Hi Henrik,

Thanks for creating nice applications. I want to suggest a simple thing. I am not sure whether we should change the code or document it somewhere.

In worldcities.py the code states to read the VCAP_SERVICE env variable in this fashion.

db2info = json.loads(os.environ['VCAP_SERVICES'])['dashDB'][0]

However this will work only for the Db2 Warehouse on Cloud ( Previously called dashDB) and not for Db2 on Cloud ( Previously called dashDB For Transactions ). So can we specify in the document somehwhere that is anybody is using the Db2 Lite plan or any other Db2 plan , they need to modify the code read the VCAP services in the following fashion.

db2info = json.loads(os.environ['VCAP_SERVICES'])['dashDB For Transactions'][0]

Thank you.

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.