コード例 #1
0
 def test_SkyQuery_listDatasetTables(self):
     tables = SkyQuery.listDatasetTables("MyDB")
コード例 #2
0
#long asynchronous job
print(
    'submitting SQL job to SciServer... could take some time depending on query length and SciServer load...'
)
jobID = CasJobs.submitJob(query + "into myDB." + tname, "dr14")
CasJobs.waitForJob(jobID, verbose=True)

try:
    #Download table from MYDB into Pandas dataframe. additional parms: , top=10
    print('Attempting to download table...')
    data_table = SkyQuery.getTable(tableName=tname, datasetName='MyDB')
    print('Done! Table shape is: ' + str(data_table.shape))
    #save df to disk in case of super long queries:
    filename = 'test_query_table_1000'
    print('Saving tables to disk as: ' + filename)
    save_obj(data_table, filename)
except:
    print(
        'ERROR, No data found in your SciServer database, query may not have completed, check your SQL syntax?'
    )
    #see tables in MyDB
    tables = SkyQuery.listDatasetTables('MyDB')
    print('tables found: ', tables)

#CLEAN UP: delete table from myDB
SkyQuery.dropTable(tableName=tname, datasetName='MyDB')
#Check tables are gone from MyDB
#tables = SkyQuery.listDatasetTables('MyDB')
#print('tables in MyDB (should be none?): '+str(tables))
コード例 #3
0
print(datasets)


# In[ ]:

#get info about the user's personal database or dataset

info = SkyQuery.getDatasetInfo("MyDB")
print(info)


# In[ ]:

#list tables inside dataset

tables = SkyQuery.listDatasetTables("MyDB")
print(tables)


# In[ ]:

#list available job queues

queueList = SkyQuery.listQueues()
print(queueList)


# In[ ]:

#list available job queues and related info