program to store and update pokemons using SQL and Flask

Overview

Pokemon

SQL and Flask Pokemons api in python.

Technologies

  • flask
  • pymysql

Description

PokeCorp is a company that tracks pokemon and their trainers around the world.

Until this day, they've been storing all their data together, in the attached JSON file that looks like this:

, "name": , "type": , "height": , "weight": , "ownedBy": [ {name: , town: }, ... ] }, ...] ">
[{ 
    "id": 
         
          , 
    "name": 
          
           , 
    "type": 
           
            , 
    "height": 
            
             , 
    "weight": 
             
              , "ownedBy": [ {name: 
              
               , town: 
               
                }, ... ] }, ...] 
               
              
             
            
           
          
         

The file has 151 pokemon in it. Each pokemon has some data, as well as an ownedBy field.

The ownedBy field is an array of objects, where each object represents a trainer that owns this pokemon - note that this array might be empty.

In this project we were required to migrate all of the data to an SQL database, create the tables using plain SQL, and then do all the INSERTs in python using the pymysql package.

Once we were done, we wrote functions for the following queries:

  • heaviest_ pokemon(): returns the heaviest pokemon (the one with the biggest weight property).
  • find_by_type(type): receives a pokemon type, and returns all of the pokemon names with that type.
  • find_owners(pokemon __name): receives the name of a pokemon, and returns the names of all the trainers that own it, or an empty array if no one owns it.
  • find_roster(trainer_name): receives the name of a trainer, and returns the names of all the pokemon he or she owns.
  • finds_most_owned(): finds the most owned pokemon, meaning the pokemon that has the highest number of owners.

At the next stage, we were required to implement a server with api to the pokemons database. The api:

  • /pokemons/ GET: returns all the pokemons of a given owner.
  • /trainers/ GET: returns all the trainers of a given pokemon.
  • /pokemons POST: adds a new pokemon with the following information: id, name, height, weight, types (all of them).
  • /pokemons/get_by_type/ GET: returns all pokemons with the specific type.
  • /pokemons/ DELETE: deletes pokemon.
  • /pokemons/ DELETE: deletes all pokemons of trainer.
  • /pokemons/types/ PUT: updates pokemon types.
  • /evolve PUT: evolves specific pokemon of specific trainer.

Evolution

  1. Get the info of a specific pokemon.

  2. From the pokemon general info, get the species url.

  3. Get the info of the species, by making a request to the species url .

  4. From the species info get the evolution chain url.

  5. Get the info of the evolution chain, by making a request to the evolution chain url.

  6. From the evolution chain info get the chain item.

  7. Scan the chain item to find what is the next form of your pokemon.

  8. You should end up with the name of the evolved pokemon.

  9. Update the DB accordingly.

Original database

Pokémon Data

You might also like...
This is friendlist update tools & old idz clon & follower idz clon etc
This is friendlist update tools & old idz clon & follower idz clon etc

This is friendlist update tools & old idz clon & follower idz clon etc

Update your Nintendo Switch cheats with one click, or a bit more~
Update your Nintendo Switch cheats with one click, or a bit more~

Interactive-ASM-Cheats-Updater This updater unlocks your ability of updating most of the ASM cheats for Nintendo Switch. Table of Contents Functions Q

Birthday program - A program that lookups a birthday txt file and compares to the current date to check for birthdays
Birthday program - A program that lookups a birthday txt file and compares to the current date to check for birthdays

Birthday Program This is a program that lookups a birthday txt file and compares

This program generates automatically new folders containing old version of program

Automated Folder Versions Generator by Sergiy Grimoldi - V.0.0.2 This program generates automatically new folders containing old version of something

Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

 PREFS is a Python library to store and manage preferences and settings.
PREFS is a Python library to store and manage preferences and settings.

PREFS PREFS is a Python library to store and manage preferences and settings. PREFS stores a Python dictionary in a total human-readable file, the PRE

Airflow Operator for running Soda SQL scans

Airflow Operator for running Soda SQL scans

A GUI love Calculator which saves all the User Data in text file(sql based script will be uploaded soon). Interative GUI. Even For Admin Panel

Love-Calculator A GUI love Calculator which saves all the User Data in text file(sql based script will be uploaded soon). Interative GUI, even For Adm

Introduction to Databases Coursework 2 (SQL) - dataset generator

Introduction to Databases Coursework 2 (SQL) - dataset generator This is python script generates a text file with insert queries for the schema.sql fi

Owner
Sara Hindy Salfer
Sara Hindy Salfer
A project to work with databases in 4 worksheets, insert, update, select, delete using Python and MySqI

A project to work with databases in 4 worksheets, insert, update, select, delete using Python and MySqI As a small project for school or college hope it is useful

Sina Org 1 Jan 11, 2022
ArinjoyTheDev 1 Jul 17, 2022
Appointment Tracker that allows user to input client information and update if needed.

Appointment-Tracker Appointment Tracker allows an assigned admin to input client information regarding their appointment and their appointment time. T

IS Coding @ KSU 1 Nov 30, 2021
⚙️ Compile, Read and update your .conf file in python

⚙️ Compile, Read and update your .conf file in python

Reece Harris 2 Aug 15, 2022
Blender addon, import and update mixamo animation

This is a blender addon for import and update mixamo animations.

ywaby 7 Apr 19, 2022
A script to automatically update bot status at GitHub as well as in Telegram channel.

A simple & short repository to show your bot's status in your GitHub README.md file as well as in you channel.

Jainam Oswal 55 Dec 13, 2022
Online-update est un programme python permettant de mettre a jour des dossier et de fichier depuis une adresse web.

Démarrage rapide Online-update est un programme python permettant de mettre a jour des dossier et de fichier depuis une adresse web. Mode préconfiguré

pf4 2 Nov 26, 2021
Tesla App Update Differences Extractor

Tesla App Update Differences Extractor Python program that finds the differences between two versions of the Tesla App. When Tesla updates the app a l

Adrian 5 Apr 11, 2022
A python script for osu!lazer rulesets auto update.

osu-lazer-rulesets-autoupdater A python script for osu!lazer rulesets auto update. How to use: 如何使用: You can refer to the python script. The begining

null 3 Jul 26, 2022
The update manager for the ERA App (era.sh)

ERA Update Manager This is the official update manager used in the ERA app (see era.sh) How it works Once a new version of ERA is available, the app l

Kian Shahriyari 1 Dec 29, 2021