Created
January 23, 2017 23:42
-
-
Save johntbush/86eecd5fb0b9242c4e388ff7aa92b9c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def reimport(id): | |
r = requests.get("{}/config/{}".format(sheets_api, id)).json() | |
data = r['data'] | |
print str('loaded: ' + str(data)) | |
requests.delete("{}/config/{}".format(sheets_api, id)) | |
partitionkeys = data['partitionkeys'] | |
default = data['default'] | |
readonly = data['readonly'] | |
data = {'server':data['server'], | |
'description':data['description'], | |
'schemaname':data['schemaname'], | |
'tablename':data['tablename'], | |
'database':data['database'], | |
'disabled' : False, | |
'source':'mssql', | |
'type':'sql', | |
'schedule':'0 0 * * 5', | |
'execute':data['execute'], | |
'owner':data['owner']} | |
requests.post("{}/config/".format(sheets_api), data=data) | |
requests.post("{}/config/{}".format(sheets_api, id), data={'partitionkeys' : partitionkeys, 'readonly' : readonly, 'default' :default }) | |
return requests.get("{}/config/{}".format(sheets_api, id)) | |
sheets_api = 'http://sheets.s03.filex.com/' | |
id = 'c84d8a23-8d47-5c02-ac65-b6eb45410cd1' | |
#['47394612-6e16-595f-bf9f-d29d7e266b4d','13925ad9-acd8-5e55-9358-b2497e2ee509'] | |
r = reimport(id) | |
print str(r.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment