本文整理汇总了Python中beeswax.conf.APPLY_NATURAL_SORT_MAX类的典型用法代码示例。如果您正苦于以下问题:Python APPLY_NATURAL_SORT_MAX类的具体用法?Python APPLY_NATURAL_SORT_MAX怎么用?Python APPLY_NATURAL_SORT_MAX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了APPLY_NATURAL_SORT_MAX类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tables
def get_tables(self, database='default', table_names='*', table_types=None):
if self.server_name == 'beeswax':
identifier = self.to_matching_wildcard(table_names)
else:
identifier = None
tables = self.client.get_tables(database, identifier, table_types)
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables)
return tables
示例2: get_tables_meta
def get_tables_meta(self, database="default", table_names="*", table_types=None):
if self.server_name == "beeswax":
identifier = self.to_matching_wildcard(table_names)
else:
identifier = None
tables = self.client.get_tables_meta(database, identifier, table_types)
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables, key="name")
return tables
示例3: get_databases
def get_databases(self, database_names='*'):
if database_names != '*':
database_names = self.to_matching_wildcard(database_names)
databases = self.client.get_databases(schemaName=database_names)
if len(databases) <= APPLY_NATURAL_SORT_MAX.get():
databases = apply_natural_sort(databases)
return databases
示例4: get_tables_meta
def get_tables_meta(self, database='default', table_names='*', table_types=None):
database = database.lower() # Impala is case sensitive
if self.server_name == 'beeswax':
identifier = self.to_matching_wildcard(table_names)
else:
identifier = None
tables = self.client.get_tables_meta(database, identifier, table_types)
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables, key='name')
return tables
示例5: get_databases
def get_databases(self, database_names='*'):
identifier = self.to_matching_wildcard(database_names)
hql = "SHOW DATABASES LIKE '%s'" % (identifier) # self.client.get_databases() is too slow
query = hql_query(hql)
timeout = SERVER_CONN_TIMEOUT.get()
handle = self.execute_and_wait(query, timeout_sec=timeout)
if handle:
result = self.fetch(handle, rows=5000)
self.close(handle)
databases = [name for database in result.rows() for name in database]
if len(databases) <= APPLY_NATURAL_SORT_MAX.get():
databases = apply_natural_sort(databases)
return databases
else:
return []
示例6: get_tables
def get_tables(self, database='default', table_names='*'):
identifier = self.to_matching_wildcard(table_names)
hql = "SHOW TABLES IN `%s` '%s'" % (database, identifier) # self.client.get_tables(database, table_names) is too slow
query = hql_query(hql)
timeout = SERVER_CONN_TIMEOUT.get()
handle = self.execute_and_wait(query, timeout_sec=timeout)
if handle:
result = self.fetch(handle, rows=5000)
self.close(handle)
tables = [name for table in result.rows() for name in table]
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables)
return tables
else:
return []
示例7: get_tables
def get_tables(self, database='default', table_names='*'):
identifier = self.to_matching_wildcard(table_names)
identifier = "'%s'" % identifier if identifier != '*' else '' # Filter not supported in SparkSql
hql = "SHOW TABLES IN `%s` %s" % (database, identifier) # self.client.get_tables(database, table_names) is too slow
query = hql_query(hql)
timeout = SERVER_CONN_TIMEOUT.get()
handle = self.execute_and_wait(query, timeout_sec=timeout)
if handle:
result = self.fetch(handle, rows=5000)
self.close(handle)
tables = [table[0] for table in result.rows()] # We only keep the first column as the name, SparkSql returns multiple columns
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables)
return tables
else:
return []
示例8: get_tables_meta
def get_tables_meta(self, database='default', table_names='*'):
identifier = self.to_matching_wildcard(table_names)
tables = self.client.get_tables_meta(database, identifier)
if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
tables = apply_natural_sort(tables, key='name')
return tables