Add option to enable Auto Get Schema

This commit is contained in:
toru-takahashi 2016-03-08 02:05:05 +09:00
parent f07ed1df31
commit a98ead9030

View File

@ -48,9 +48,14 @@ class TreasureData(BaseQueryRunner):
'type': { 'type': {
'type': 'string' 'type': 'string'
}, },
"db": { 'db': {
"type": "string", 'type': 'string',
"title": "Database Name" 'title': 'Database Name'
},
'getschema': {
'type': 'boolean',
'title': 'Auto Get Schema',
'Default': True
} }
}, },
'required': ['apikey','db'] 'required': ['apikey','db']
@ -71,8 +76,9 @@ class TreasureData(BaseQueryRunner):
def __init__(self, configuration): def __init__(self, configuration):
super(TreasureData, self).__init__(configuration) super(TreasureData, self).__init__(configuration)
def get_schema(self): def get_schema(self, get_stats=False):
schema = {} schema = {}
if self.configuration.get('getschema') == True:
try: try:
with tdclient.Client(self.configuration.get('apikey')) as client: with tdclient.Client(self.configuration.get('apikey')) as client:
for table in client.tables(self.configuration.get('db')): for table in client.tables(self.configuration.get('db')):