Giter VIP home page Giter VIP logo

jumble's Introduction

jumble

Python implementation of the classic scrambled word game

Setup

First time database creation

  • make sure to fill relevant information in .env file for DB creation

    POSTGRES_USER=#####
    POSTGRES_PASSWORD=#####
    POSTGRES_DATABASE_NAME=jumble-db # chosen db name
    POSTGRES_IP=localhost:#### # connect to db using psql and type `\conninfo`
    
  • excecute the script under jumble/database.py to create the db.

  • create tables using alembic

    • initialise alembic alembic init alembic
    • edit the alembic/env.py file:
      • update target_metadata to use the models created
      • add line config.set_main_option("sqlalchemy.url", os.environ["POSTGRES_DATABASE_URL"]) to tell alembic how to connect to db
    • finally run the following cmd to create all tables
    alembic revision --autogenerate -m "added tables"
    
    • double check the created revision under alembic/versions

    Connecting to CloudSQL

    TO create an instance on to cloud SQL, go to gcp console UI - SQL section, and create a DB with the following properties"

    • instanceID=$POSTGRES_DATABASE_NAME
    • root-password=$POSTGRES_PASSWORD
    • database-version=POSTGRES_14
    • region=$LOCATION
    • connections:
      • Private IP
      • default network
      • Allocated IP range: Use automatically assigned IP range

Refering to variables as defined in the .env file.

Get the IP address of newly created instance running

gcloud sql instances describe $POSTGRES_DATABASE_NAME | grep ipAddress

Finally create a db inside the instance running (we make teh chocie here to name the db same as instance on cloudSQL):

gcloud sql databases create $POSTGRES_DATABASE_NAME --instance=$POSTGRES_DATABASE_NAME

jumble's People

Contributors

badrbmb 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.