GithubHelp home page GithubHelp logo

wwcodekl / pyp-u5-c1-gists-database Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonhandy/pyp-u5-c1-gists-database

0.0 3.0 0.0 23 KB

License: Creative Commons Attribution Share Alike 4.0 International

Makefile 2.22% Python 97.78%

pyp-u5-c1-gists-database's Introduction

Gist Database

Today's project will combine our work with the requests library and iterator usage with a new topic, databases. We will use requests to interface with Github's API to retrieve gists and store them in a database that we will then be able to perform searches on.

The Importer

Your import_gists_to_database function will take three parameters:

  • db: The database object to connect to
  • username: The GitHub user whose gists we are going to retrieve
  • commit (Optional, defaults to True): If True, automatically commit changes to database

You are going to use the GitHub gists API to retrieve the gists of a given user, insert those gists into a database (schema may be found in the schema.sql file), and if commit is True, commit those changes to the database.

The Searcher

Your search_gists method should take a db_connection parameter (the database connection), as well as a variable number of keyword arguments to use in the search. This function should ultimately return an iterator that pumps out Gist objects with all the appropriate data filled in. These are the various keyword arguments your function should accept:

  • github_id
  • public
  • created_at__gt
  • created_at__gte
  • created_at__lt
  • created_at__lte
  • updated_at__gt
  • updated_at__gte
  • updated_at__lt
  • updated_at__lte
  • comments

Datetime query parameters: The keyword arguments starting with created and updated will be operating such that they will be comparing against the created_at and updated_at fields using the corresponding comparison:gt means greater than, gte greater than or equal tho, lt less than, lte less than or equal to When comparing dates in your sql statements use the format datetime(attribute) operator datetime(comparing_date)

Remember, the search should return an iterator that pumps out Gist objects (Gist definition is in models.py)

pyp-u5-c1-gists-database's People

Contributors

jsymons avatar ivanzugnoni avatar santiagobasulto avatar martinzugnoni avatar

Watchers

Daphne Wade avatar James Cloos avatar Chee Yim Goh 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.