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-05-08 14:55:53 +00:00
|
|
|
#include <Core/PostgreSQL/PoolWithFailover.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(
|
2021-04-10 23:33:54 +00:00
|
|
|
const ASTPtr & ast_function, ContextPtr context,
|
2020-11-25 21:06:33 +00:00
|
|
|
const std::string & table_name, ColumnsDescription cached_columns) const override;
|
|
|
|
|
|
|
|
const char * getStorageTypeName() const override { return "PostgreSQL"; }
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
ColumnsDescription getActualTableStructure(ContextPtr context) const override;
|
|
|
|
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
|
2020-11-25 21:06:33 +00:00
|
|
|
|
|
|
|
String connection_str;
|
2021-08-24 12:29:42 +00:00
|
|
|
String remote_table_name, remote_table_schema, on_conflict;
|
2021-03-27 20:14:02 +00:00
|
|
|
postgres::PoolWithFailoverPtr connection_pool;
|
2020-11-25 21:06:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|