def test_cache_table_pool_name(): statement = ddl.CacheTable('foo', database='bar') query = statement.compile() expected = "ALTER TABLE bar.`foo` SET CACHED IN 'default'" assert query == expected statement = ddl.CacheTable('foo', database='bar', pool='my_pool') query = statement.compile() expected = "ALTER TABLE bar.`foo` SET CACHED IN 'my_pool'" assert query == expected
def cache_table(self, table_name, database=None, pool='default'): """Caches a table in cluster memory in the given pool. Parameters ---------- table_name Table name database Database name pool The name of the pool in which to cache the table Examples -------- >>> table = 'my_table' >>> db = 'operations' >>> pool = 'op_4GB_pool' >>> con.cache_table('my_table', database=db, pool=pool) # noqa: E501 # doctest: +SKIP """ statement = ddl.CacheTable(table_name, database=database, pool=pool) self.raw_sql(statement)