ClickHouse/src/Storages/StorageXDBC.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.1 KiB
C++
Raw Normal View History

2018-09-25 14:29:44 +00:00
#pragma once
#include <Storages/StorageURL.h>
2022-04-27 15:05:45 +00:00
#include <BridgeHelper/XDBCBridgeHelper.h>
2018-09-25 14:29:44 +00:00
namespace Poco
{
class Logger;
}
2019-08-24 21:20:20 +00:00
2018-09-25 14:29:44 +00:00
namespace DB
{
2019-08-24 21:20:20 +00:00
2018-09-25 14:29:44 +00:00
/** Implements storage in the XDBC database.
* Use ENGINE = xdbc(connection_string, table_name)
* Example ENGINE = odbc('dsn=test', table)
* Read only.
*/
2019-08-24 21:20:20 +00:00
class StorageXDBC : public IStorageURLBase
{
public:
2020-08-03 13:54:14 +00:00
Pipe read(
const Names & column_names,
const StorageSnapshotPtr & storage_snapshot,
SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
unsigned num_streams) override;
2018-09-25 14:29:44 +00:00
StorageXDBC(
const StorageID & table_id_,
const std::string & remote_database_name,
const std::string & remote_table_name,
ColumnsDescription columns_,
ConstraintsDescription constraints_,
2021-04-23 12:18:23 +00:00
const String & comment,
ContextPtr context_,
BridgeHelperPtr bridge_helper_);
2018-09-25 14:29:44 +00:00
2021-07-23 14:25:35 +00:00
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
2020-04-28 00:56:44 +00:00
std::string getName() const override;
2019-08-24 21:20:20 +00:00
private:
BridgeHelperPtr bridge_helper;
std::string remote_database_name;
std::string remote_table_name;
2018-09-25 14:29:44 +00:00
2019-08-24 21:20:20 +00:00
Poco::Logger * log;
2018-09-25 14:29:44 +00:00
2019-08-24 21:20:20 +00:00
std::string getReadMethod() const override;
2018-09-25 14:29:44 +00:00
std::vector<std::pair<std::string, std::string>> getReadURIParams(
const Names & column_names,
const StorageSnapshotPtr & storage_snapshot,
const SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size) const override;
2018-09-25 14:29:44 +00:00
std::function<void(std::ostream &)> getReadPOSTDataCallback(
const Names & column_names,
2022-02-28 13:29:05 +00:00
const ColumnsDescription & columns_description,
const SelectQueryInfo & query_info,
ContextPtr context,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size) const override;
2018-09-25 14:29:44 +00:00
Block getHeaderBlock(const Names & column_names, const StorageSnapshotPtr & storage_snapshot) const override;
2022-02-28 13:29:05 +00:00
2022-05-13 18:39:19 +00:00
bool supportsSubsetOfColumns() const override;
2019-08-24 21:20:20 +00:00
};
2018-09-25 14:29:44 +00:00
}