2020-11-25 21:06:33 +00:00
|
|
|
#pragma once
|
|
|
|
#if !defined(ARCADIA_BUILD)
|
|
|
|
#include "config_core.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if USE_LIBPQXX
|
|
|
|
#include <TableFunctions/ITableFunction.h>
|
2021-03-27 20:14:02 +00:00
|
|
|
#include <Storages/PostgreSQL/PostgreSQLPoolWithFailover.h>
|
2020-11-25 21:06:33 +00:00
|
|
|
|
2021-01-11 10:23:44 +00:00
|
|
|
|
2020-11-25 21:06:33 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class TableFunctionPostgreSQL : public ITableFunction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static constexpr auto name = "postgresql";
|
|
|
|
std::string getName() const override { return name; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
StoragePtr executeImpl(
|
|
|
|
const ASTPtr & ast_function, const Context & context,
|
|
|
|
const std::string & table_name, ColumnsDescription cached_columns) const override;
|
|
|
|
|
|
|
|
const char * getStorageTypeName() const override { return "PostgreSQL"; }
|
|
|
|
|
|
|
|
ColumnsDescription getActualTableStructure(const Context & context) const override;
|
|
|
|
void parseArguments(const ASTPtr & ast_function, const Context & context) override;
|
|
|
|
|
|
|
|
String connection_str;
|
2021-03-14 10:35:10 +00:00
|
|
|
String remote_table_name, remote_table_schema;
|
2021-03-27 20:14:02 +00:00
|
|
|
postgres::PoolWithFailoverPtr connection_pool;
|
2020-11-25 21:06:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|