ClickHouse/src/Processors/Transforms/MongoDBSource.h

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

49 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
#include <Core/Block.h>
2022-05-20 19:49:31 +00:00
#include <Processors/ISource.h>
2019-02-15 11:46:07 +00:00
#include <Core/ExternalResultDescription.h>
2016-12-08 02:49:04 +00:00
namespace Poco
2016-12-08 02:49:04 +00:00
{
namespace MongoDB
{
class Connection;
class Cursor;
}
2016-12-08 02:49:04 +00:00
}
namespace DB
{
2020-06-26 14:28:00 +00:00
void authenticate(Poco::MongoDB::Connection & connection, const std::string & database, const std::string & user, const std::string & password);
std::unique_ptr<Poco::MongoDB::Cursor> createCursor(const std::string & database, const std::string & collection, const Block & sample_block_to_select);
/// Converts MongoDB Cursor to a stream of Blocks
2022-05-20 19:49:31 +00:00
class MongoDBSource final : public ISource
{
public:
MongoDBSource(
std::shared_ptr<Poco::MongoDB::Connection> & connection_,
std::unique_ptr<Poco::MongoDB::Cursor> cursor_,
const Block & sample_block,
2022-04-19 08:59:47 +00:00
UInt64 max_block_size_);
~MongoDBSource() override;
String getName() const override { return "MongoDB"; }
private:
Chunk generate() override;
std::shared_ptr<Poco::MongoDB::Connection> connection;
std::unique_ptr<Poco::MongoDB::Cursor> cursor;
2019-02-10 16:55:12 +00:00
const UInt64 max_block_size;
2016-04-10 02:32:59 +00:00
ExternalResultDescription description;
bool all_read = false;
};
}