def get_topic_data(user, name): interpreter = _get_interpreter_from_dialect('ksql', user) api = _get_notebook_api(user, connector_id=interpreter['type']) data = api.get_sample_data(snippet={}) print(data) return data
def get_topic_data(user, name): from desktop.api_public import _get_interpreter_from_dialect # due to a circular import interpreter = _get_interpreter_from_dialect('ksql', user) api = _get_notebook_api(user, connector_id=interpreter['type']) data = api.get_sample_data(snippet={}) print(data) return data
def get_topics(user): if has_kafka_api(): return KafkaApi().topics() else: data = {'snippet': {}, 'database': 'topics'} return [ topic['name'] for topic in _get_notebook_api(user, connector_id=56).autocomplete( **data)['tables_meta'] if not topic['name'].startswith('__') ]
def get_topics(user): if has_kafka_api(): return KafkaApi().topics() else: data = {'snippet': {}, 'database': 'topics'} interpreter = _get_interpreter_from_dialect('ksql', user) api = _get_notebook_api(user, connector_id=interpreter['type']) return [ topic['name'] for topic in api.autocomplete(**data)['tables_meta'] if not topic['name'].startswith('__') ]
def get_topic_data(user, name): if has_kafka_api(): print(SchemaRegistryApi().subjects()) print(SchemaRegistryApi().subject(name='Kafka-value')) data = { 'full_headers': [{ 'name': 'message', 'type': 'string' }], 'rows': [['This is rider 894 and I am at 38.1952, -123.1723'], ['This is rider 98 and I am at 39.2531, -121.9547'], ['This is rider 564 and I am at 22.3431, -111.7670']] } else: from desktop.api_public import _get_interpreter_from_dialect # Avoid circular import interpreter = _get_interpreter_from_dialect('ksql', user) api = _get_notebook_api(user, connector_id=interpreter['type']) data = api.get_sample_data(snippet={}) print(data) return data
def action(self, appid, action): message = {'message': '', 'status': 0} if action.get('action') == 'kill': for queryid in appid: notebook = {} snippet = { 'result': { 'handle': { 'secret': queryid, 'guid': queryid, 'has_result_set': False } } } connector_id = 'hive' response = _get_notebook_api(self.user, connector_id).cancel( notebook, snippet) message['status'] = response[ 'status'] if response['status'] != 0 else message['status'] message['message'] = _('kill action performed') return message
def get_topic_data(user, name): data = _get_notebook_api(user, connector_id=56).get_sample_data(snippet={}) print(data) return data