Esempio n. 1
0
def insert_issue_row(connection, issue_row):
    postgres_cursor = connection.cursor()
    insert_statement_template = """
    insert into Issues(Guid,Id,Title,UserStoryId,CreatedById,UpdatedOn,UpdatedById,CreatedOn,ResponsibleId,Status,Severity,ReleaseId,SprintId,EffortEstimate,EffortRemaining,EffortLogged) 
    values('{0}',{1},'{2}',{3},{4},'{5}',{6},'{7}',{8},'{9}','{10}',{11},{12},{13},{14},{15});
    """
    insert_statement = insert_statement_template.format(
        issue_row['Guid'],  #{0} text
        issue_row['Id'],  #{1} int
        fnx.escape_postgres_string(issue_row['Title']),  #{2} text
        issue_row['UserStoryId'],  #{3} int        
        issue_row['CreatedById'],  #{4} int
        issue_row['UpdatedOn'],  #{5} timestamp without time zone
        issue_row['UpdatedById'],  #{6} int
        issue_row['CreatedOn'],  #{7} timestamp without time zone
        issue_row['ResponsibleId'],  #{8} int
        issue_row['Status'],  #{9} text
        issue_row['Severity'],  #{10} text
        issue_row['ReleaseId'],  #{11} int
        issue_row['SprintId'],  #{12} int
        issue_row['EffortEstimate'],  #{13} real
        issue_row['EffortRemaining'],  #{14} real
        issue_row['EffortLogged']  #{15} real
    )
    postgres_cursor.execute(insert_statement)
    connection.commit()
Esempio n. 2
0
def insert_sprint_row(connection, sprint_row):
    postgres_cursor = connection.cursor()
    insert_statement_template = """
    insert into sprints(Guid,Id,Title,CreatedById,UpdatedOn,CreatedOn,Status,StartDate,EndDate) 
    values('{0}',{1},'{2}',{3},'{4}','{5}','{6}','{7}','{8}');
    """
    insert_statement = insert_statement_template.format(
        sprint_row['Guid'],  #{0} text
        sprint_row['Id'],  #{1} int
        fnx.escape_postgres_string(sprint_row['Title']),  #{2} text
        sprint_row['CreatedById'],  #{3} int
        sprint_row['UpdatedOn'],  #{4} timestamp without time zone
        sprint_row['CreatedOn'],  #{5} timestamp without time zone
        sprint_row['Status'],  #{6} text
        sprint_row['StartDate'],  #{7} timestamp without time zone
        sprint_row['EndDate']  #{8} timestamp without time zone
    )
    postgres_cursor.execute(insert_statement)
    connection.commit()
Esempio n. 3
0
def insert_task_row(connection, task_row):
    postgres_cursor = connection.cursor()
    insert_statement_template = """
    insert into Tasks(Guid,TaskId,TaskOwnerId,UserStoryId,Title,CreatedById,UpdatedOn,UpdatedById,CreatedOn,Status,EffortEstimate,EffortRemaining,EffortLogged) 
    values('{0}',{1},{2},{3},'{4}',{5},'{6}',{7},'{8}','{9}',{10},{11},{12});
    """
    insert_statement = insert_statement_template.format(
        task_row['Guid'],  #{0} text
        task_row['TaskId'],  #{1} int
        task_row['TaskOwnerId'],  #{2} int
        task_row['UserStoryId'],  #{3} int
        fnx.escape_postgres_string(task_row['Title']),  #{4} text
        task_row['CreatedById'],  #{5} int
        task_row['UpdatedOn'],  #{6} timestamp without time zone
        task_row['UpdatedById'],  #{7} int
        task_row['CreatedOn'],  #{8} timestamp without time zone
        task_row['Status'],  #{9} text
        task_row['EffortEstimate'],  #{10} real
        task_row['EffortRemaining'],  #{11} real
        task_row['EffortLogged'],  #{12} real
    )
    postgres_cursor.execute(insert_statement)
    connection.commit()
def insert_userstory_row(connection, userstory_row):
    postgres_cursor = connection.cursor()
    insert_statement_template = """
    insert into UserStories(Guid,Id,Title,CreatedById,UpdatedOn,UpdatedById,CreatedOn,ResponsibleId,Status,ReleaseId,SprintId,EffortEstimate,EffortRemaining,EffortLogged) 
    values('{0}',{1},'{2}',{3},'{4}',{5},'{6}',{7},'{8}',{9},{10},{11},{12},{13});
    """
    insert_statement = insert_statement_template.format(
        userstory_row['Guid'],  #{0} text
        userstory_row['Id'],  #{1} int
        fnx.escape_postgres_string(userstory_row['Title']),  #{2} text
        userstory_row['CreatedById'],  #{3} int
        userstory_row['UpdatedOn'],  #{4} timestamp without time zone
        userstory_row['UpdatedById'],  #{5} int
        userstory_row['CreatedOn'],  #{6} timestamp without time zone
        userstory_row['ResponsibleId'],  #{7} int - owner in yodiz api 
        userstory_row['Status'],  #{8} text
        userstory_row['ReleaseId'],  #{9} int
        userstory_row['SprintId'],  #{10} int
        userstory_row['EffortEstimate'],  #{11} real
        userstory_row['EffortRemaining'],  #{12} real
        userstory_row['EffortLogged'],  #{13} real
    )
    postgres_cursor.execute(insert_statement)
    connection.commit()