예제 #1
0
def get_tables(params):

          datasetID = params.dataSetName
          db = params.db
          if db.lower() == 'bigquery':
              try:
                  result = bqhandler.get_tables(datasetID)
              except Exception, err:
                  return  comm.format_response(False,err,"Error Occurred when retrieving tables!",exception=sys.exc_info())
              return  comm.format_response(True,result,"Tables retrieved!",exception=None)
          elif db.lower() == 'mssql':
              datasetID = params.dataSetName
              tables = mssqlhandler.get_tables(datasetID)
              return  comm.format_response(True,tables,"",exception=None)
          elif db.lower() == 'postgresql':
              tables = pgsqlhandler.get_Tables()
              return comm.format_response(True,tables,"",exception=None)
          elif db.lower() == 'mysql':
              tables = mysqlhandler.get_tables(datasetID)
              return comm.format_response(True,tables,"",exception=None)
          else:
              return "db not implemented"


def create_Dataset(params):
          datasetID = params.dataSetName
          db = params.db
          if db.lower() == 'bigquery':
              try:
                   result = bqhandler.create_dataset(datasetID)
                   return  comm.format_response(True,result,"",exception=None)