| 1 | #pragma once |
| 2 | |
| 3 | #include <TableFunctions/ITableFunction.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | /* remote ('address', db, table) - creates a temporary StorageDistributed. |
| 10 | * To get the table structure, a DESC TABLE request is made to the remote server. |
| 11 | * For example |
| 12 | * SELECT count() FROM remote('example01-01-1', merge, hits) - go to `example01-01-1`, in the merge database, the hits table. |
| 13 | * An expression that generates a set of shards and replicas can also be specified as the host name - see below. |
| 14 | * Also, there is a cluster version of the function: cluster('existing_cluster_name', 'db', 'table') |
| 15 | */ |
| 16 | class TableFunctionRemote : public ITableFunction |
| 17 | { |
| 18 | public: |
| 19 | TableFunctionRemote(const std::string & name_, bool secure_ = false); |
| 20 | |
| 21 | std::string getName() const override { return name; } |
| 22 | |
| 23 | private: |
| 24 | StoragePtr executeImpl(const ASTPtr & ast_function, const Context & context, const std::string & table_name) const override; |
| 25 | |
| 26 | std::string name; |
| 27 | bool is_cluster_function; |
| 28 | std::string help_message; |
| 29 | bool secure; |
| 30 | }; |
| 31 | |
| 32 | } |
| 33 | |