Giter VIP home page Giter VIP logo

gh2db's Introduction

gh2db

PyPI version

Migrate GitHub data to database.

Environment variables

# GitHub API
export GH2DB_GITHUB_TOKEN=
export GH2DB_GITHUB_TARGET_ORGANIZATION_NAME=
export GH2DB_GITHUB_PER_PAGE=100
export GH2DB_GITHUB_MAX_PAGE_REPOSITORIES=3
export GH2DB_GITHUB_MAX_PAGE_PULL_REQUESTS=3
export GH2DB_GITHUB_MAX_PAGE_TEAMS=3
export GH2DB_GITHUB_MAX_PAGE_TEAM_MEMBERS=3

# Database(MySQL)
export GH2DB_DB_DB_URI=mysql://root:@localhost:22/gh2db?charset=utf8
# Database(SQLite)
export GH2DB_DB_DB_URI=sqlite:///sample_db.sqlite3
# Database(SQLite Un-memory)
export GH2DB_DB_DB_URI=sqlite:///:memory:
# Database(PostgreSQL)
export GH2DB_DB_DB_URI=postgresql///?User=postgres&Password=admin&Database=postgres&Server=127.0.0.1&Port=5432
# Database(Oracle)
export GH2DB_DB_DB_URI=oracleoci///?User=myuser&Password=mypassword&Server=localhost&Port=1521
# Database(MS SQL)
export GH2DB_DB_DB_URI=sql///?User=myUser&Password=myPassword&Database=NorthWind&Server=myServer&Port=1433

export GH2DB_DB_LOG_LEVEL=ERROR
export GH2DB_APP_LOG_LEVEL=INFO

Usage

$ gh2db
usage: [-h] [--update_user] [--update_org] [--create] [--drop] [--delete]

Create

gh2db --create
[2021-09-27 21:26:04 INFO] Create all tables start
[2021-09-27 21:26:04 INFO] Create all tables completed
+----------------------------------------+
| Tables_in_gh                           |
+----------------------------------------+
| github_organization_team_members       |
| github_organization_teams              |
| github_organizations                   |
| github_repositories                    |
| github_repository_labels               |
| github_repository_pull_request_commits |
| github_repository_pull_request_labels  |
| github_repository_pull_request_reviews |
| github_repository_pull_requests        |
| github_users                           |
+----------------------------------------+
10 rows in set (0.00 sec)

Drop

gh2db --drop
[2021-09-27 21:26:11 INFO] Drop all tables start
[2021-09-27 21:26:12 INFO] Drop all tables completed

Delete

gh2db --delete
[2021-09-27 21:27:08 INFO] Delete all of table rows start
[2021-09-27 21:27:08 INFO] Delete all of table rows completed

Update (User)

gh2db --update_user
[2021-09-27 21:28:00 INFO] ---------------------------
[2021-09-27 21:28:00 INFO] GitHub API Authorized By Personal AccessToken: OK
[2021-09-27 21:28:00 INFO] Github API Rate Limitting Information:
[2021-09-27 21:28:00 INFO] Remaining, Limit: (4441, 5000)
[2021-09-27 21:28:01 INFO] ResetTime: 2021-09-27 12:49:21
[2021-09-27 21:28:01 INFO] ---------------------------
[2021-09-27 21:28:01 INFO] User Model
[2021-09-27 21:28:01 INFO]  Repository Models (User:mshimizu)
[2021-09-27 21:28:02 INFO]   Label Models (Repository:MichinaoShimizu/anemone)
[2021-09-27 21:28:02 INFO]   Pull Request Models (Repository:MichinaoShimizu/anemone)
[2021-09-27 21:28:03 INFO]   Label Models (Repository:MichinaoShimizu/devmetrics)
[2021-09-27 21:28:03 INFO]   Pull Request Models (Repository:MichinaoShimizu/devmetrics)
[2021-09-27 21:28:05 INFO]    Pull Request Label Models (#13)
[2021-09-27 21:28:05 INFO]    Review Models (#13)
[2021-09-27 21:28:05 INFO]    Commit Models (#13)
[2021-09-27 21:28:06 INFO]    Pull Request Label Models (#10)
[2021-09-27 21:28:06 INFO]    Review Models (#10)
[2021-09-27 21:28:07 INFO]    Commit Models (#10)
[2021-09-27 21:28:08 INFO]    Pull Request Label Models (#11)
[2021-09-27 21:28:08 INFO]    Review Models (#11)
[2021-09-27 21:28:08 INFO]    Commit Models (#11)
...
[2021-09-27 21:28:45 INFO]   Label Models (Repository:MichinaoShimizu/oas_contrib)
[2021-09-27 21:28:45 INFO]   Pull Request Models (Repository:MichinaoShimizu/oas_contrib)
[2021-09-27 21:28:47 INFO] Database committed
[2021-09-27 21:28:47 INFO] Database session closed

Update (Organization)

gh2db --update_org

gh2db's People

Contributors

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