Skip to content

Commit

Permalink
move dbs setup to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
sophieball committed Feb 16, 2019
1 parent eef58a5 commit 8c55552
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dbs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import select
import os

num_proc = 30
pswd = os.environ["SQLPW"]
url = "mysql://sophie:"+pswd+"@localhost/ghtorrent-2018-03?charset=utf8mb4"
engine = create_engine(url, pool_size = num_proc, pool_recycle = 3600)
Session = sessionmaker(bind = engine)
metadata = MetaData(engine)
commits = Table("commits", metadata, autoload=True)
projects = Table("projects", metadata, autoload=True)
conns = engine.connect()
session = Session()

3 changes: 2 additions & 1 deletion project_team_famil.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from utils import *
import numpy as np
from datetime import datetime
from dbs import *

def get_team_famil(p, session, commits, contributors, contr_projs_win,
def get_team_famil(p, contributors, contr_projs_win,
proj_contrs_count, win):
contributors = list(contributors)
team_size = len(contributors)
Expand Down

0 comments on commit 8c55552

Please sign in to comment.