Posts

Showing posts from 2018

Simple GitHub Issue Export using Python

We needed a way to export GitHub issues and comments to import into Jira. This Python example easily exports these via the Rest api, and is quite simple to customize to suit your needs. Create a Personal Access Token and use this in place of the one in line 10 (after the word "token" of course). You'll need to pick through the GitHub Api if you want more things like attachments. I'm also a big fan of the Google Advanced Rest Client to review the data. Interesting coincident that M$ is in talks to buy GitHub ... import requests import json import csv api_url = 'https://github.ibm.com/api/v3/' repo = 'repos/CloudBI/reports' headers = { 'Accept': 'application/vnd.github.v3+json', 'Authorization': 'token c0ns1d3rg3tt1ingy0ur0wn' } # this will return the number pages of issues to return def get_num_pages(): r = requests.request("GET", api_url + repo, headers=headers) if r.status_co

ETL - Using Python to push data to Salesforce Analytics

The problem: develop a method to automate the process of pushing data from our Netezza reporting warehouse to Salesforce Analytics for consolidated reporting. In my quest to solve this problem, I created the Python script below. The commented yum & pip installs at the top of the script are required bits to make it work. Sharing the data is outside the scope of this script, but it is easily solved by first creating a data set and sharing it out then using the script to overwrite it. # sudo yum install python-devel # sudo pip install ibm_db # sudo pip install simple_salesforce # sudo pip install jaydebeapi from simple_salesforce import Salesforce import requests import jaydebeapi import sys import csv import base64 import os import tempfile import math # set up some variables debug = True fname = "./data/temp.csv" errlog = "./log/errorlog.txt" metadata = "./metadata/SfdcMedalliaMetadata.json" driver = "./drivers/nzjdbc.jar" # Salesf