2023-05-17 02:42:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/StorageRedis.h>
|
|
|
|
#include <TableFunctions/ITableFunction.h>
|
|
|
|
#include <Storages/ExternalDataSourceConfiguration.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2023-05-30 12:31:23 +00:00
|
|
|
/* Implements Redis table function.
|
|
|
|
* Use redis(host:port, key, structure[, db_index[, password[, pool_size]]]);
|
|
|
|
*/
|
2023-05-17 02:42:52 +00:00
|
|
|
class TableFunctionRedis : public ITableFunction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static constexpr auto name = "redis";
|
|
|
|
String getName() const override { return name; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
StoragePtr executeImpl(
|
|
|
|
const ASTPtr & ast_function, ContextPtr context,
|
2023-07-06 08:56:07 +00:00
|
|
|
const String & table_name, ColumnsDescription cached_columns, bool is_insert_query) const override;
|
2023-05-17 02:42:52 +00:00
|
|
|
|
|
|
|
const char * getStorageTypeName() const override { return "Redis"; }
|
|
|
|
|
2023-07-06 08:56:07 +00:00
|
|
|
ColumnsDescription getActualTableStructure(ContextPtr context, bool is_insert_query) const override;
|
2023-05-17 02:42:52 +00:00
|
|
|
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
|
|
|
|
|
2023-05-30 12:31:23 +00:00
|
|
|
RedisConfiguration configuration;
|
2023-05-26 02:34:37 +00:00
|
|
|
String structure;
|
2023-05-30 12:31:23 +00:00
|
|
|
String primary_key;
|
2023-05-17 02:42:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|