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

Owner
Sara Hindy Salfer
Sara Hindy Salfer
Script to automate the scanning of "old printed photos"

photoscanner Script to automate the scanning of "old printed photos" Just run: ./scan_photos.py The script is prepared to be run by fades. Otherw

Facundo Batista 2 Jan 21, 2022
BloodCheck enables Red and Blue Teams to manage multiple Neo4j databases and run Cypher queries against a BloodHound dataset.

BloodCheck BloodCheck enables Red and Blue Teams to manage multiple Neo4j databases and run Cypher queries against a BloodHound dataset. Installation

Mr B0b 16 Nov 05, 2021
Tiling manager which runs on top of EWMH window managers.

PyTyle is an extremely versatile and extensible tiling manager that is meant to be used on top of EWMH window managers. Its feature set was modeled af

55 Jul 29, 2021
Make after-work Mending More flexible In Python

Mending Make after-work Mending More flexible In Python A Lite Package focuses on making project's after-post mending pythonic and flexible. Certainly

2 Jun 15, 2022
Demo Python project using Conda and Poetry

Conda Poetry This is a demonstration of how Conda and Poetry can be used in a Python project for dev dependency management and production deployment.

Ryan Allen 2 Apr 26, 2022
Customisable coding font with alternates, ligatures and contextual positioning

Guide Ligature Support Links Log License Guide Live Preview + Download larsenwork.com/monoid Install Quit your editor/program. Unzip and open the fold

Andreas Larsen 7.6k Dec 30, 2022
→ Plantilla de registro para Python

🔧 Pasos Necesarios CMD 🖥️ SOCKETS pip install sockets 🎨 COLORAMA pip install colorama 💻 Código register-by-inputs from turtle import color # Impor

Panda.xyz 4 Mar 12, 2022
Heisenbridge a bouncer-style Matrix IRC bridge

Heisenbridge brings IRC to Matrix by creating an environment where every user connects to each network individually like they would with a traditional IRC bouncer

Toni Spets 152 Dec 28, 2022
Powering up Apache JMeter with Streamlit and opening the door for machine learning.

Powering up Apache JMeter with Streamlit Overview Apache JMeter is an open source load testing tool written in 100% pure Java. JMeter supports umpteen

NaveenKumar Namachivayam ⚡ 16 Aug 24, 2022
Old versions of Deadcord that are problematic or used as reference.

⚠️ Unmaintained and broken. We have decided to release the old version of Deadcord before our v1.0 rewrite. (which will be equiped with much more feat

Galaxzy 1 Feb 10, 2022
Ramadhan countdown - Simple daily reminder about upcoming Ramadhan

Ramadhan Countdown Bot Simple bot for displaying daily reminder about Islamic pr

Abdurrahman Shofy Adianto 1 Feb 06, 2022
This tool allows you to do goole dorking much easier

This tool allows you to do goole dorking much easier

Steven 8 Mar 06, 2022
Gives criticality score for an open source project

Open Source Project Criticality Score (Beta) This project is maintained by members of the Securing Critical Projects WG. Goals Generate a criticality

Open Source Security Foundation (OpenSSF) 1.1k Dec 23, 2022
Tutor plugin for integration of Open edX with a Richie course catalog

Richie plugin for Tutor This is a plugin to integrate Richie, the learning portal CMS, with Open edX. The integration takes the form of a Tutor plugin

Overhang.IO 2 Sep 08, 2022
A Gura parser implementation for Python

Gura parser This repository contains the implementation of a Gura format parser in Python. Installation pip install gura-parser Usage import gura gur

JWare Solutions 19 Jan 25, 2022
Compile Binary Ninja's HLIL IR to LLVM, for purposes of compiling it back to a binary again.

Compiles BinaryNinja's HLIL to LLVM Approach Sweep binary for global variables, create them Sweep binary for (used?) external functions, declare those

Kyle Martin 31 Nov 10, 2022
This library attempts to abstract the handling of Sigma rules in Python

This library attempts to abstract the handling of Sigma rules in Python. The rules are parsed using a schema defined with pydantic, and can be easily loaded from YAML files into a structured Python o

Caleb Stewart 44 Oct 29, 2022
ArinjoyTheDev 1 Jul 17, 2022
String Spy is a project aimed at improving MacOS defenses.

String Spy is a project aimed at improving MacOS defenses. It allows users to constantly monitor all running processes for user-defined strings, and if it detects a process with such a string it will

10 Dec 13, 2022
Nfog - Scriptable Database-Driven NFO Generator for Movies and TV

nfog Scriptable Database-Driven NFO Generator for Movies and TV. Installation pi

6 Oct 08, 2022