2018-06-11 12:13:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <TableFunctions/ITableFunctionFileLike.h>
|
2021-10-26 09:31:01 +00:00
|
|
|
#include <Storages/ExternalDataSourceConfiguration.h>
|
2021-12-15 11:30:57 +00:00
|
|
|
#include <IO/ReadWriteBufferFromHTTP.h>
|
2018-06-11 12:13:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-05-20 20:16:32 +00:00
|
|
|
|
|
|
|
class Context;
|
|
|
|
|
2022-02-28 00:15:37 +00:00
|
|
|
/* url(source, format[, structure, compression]) - creates a temporary storage from url.
|
2018-06-11 12:13:00 +00:00
|
|
|
*/
|
|
|
|
class TableFunctionURL : public ITableFunctionFileLike
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static constexpr auto name = "url";
|
|
|
|
std::string getName() const override
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2021-12-15 11:30:57 +00:00
|
|
|
ColumnsDescription getActualTableStructure(ContextPtr context) const override;
|
|
|
|
|
2021-09-08 19:28:22 +00:00
|
|
|
protected:
|
|
|
|
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
|
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
private:
|
|
|
|
StoragePtr getStorage(
|
2021-04-10 23:33:54 +00:00
|
|
|
const String & source, const String & format_, const ColumnsDescription & columns, ContextPtr global_context,
|
2020-10-14 12:19:29 +00:00
|
|
|
const std::string & table_name, const String & compression_method_) const override;
|
2020-04-06 05:19:40 +00:00
|
|
|
const char * getStorageTypeName() const override { return "URL"; }
|
2021-10-26 09:31:01 +00:00
|
|
|
|
2021-12-15 11:30:57 +00:00
|
|
|
ReadWriteBufferFromHTTP::HTTPHeaderEntries getHeaders() const;
|
|
|
|
|
2021-10-26 09:31:01 +00:00
|
|
|
URLBasedDataSourceConfiguration configuration;
|
2018-06-11 12:13:00 +00:00
|
|
|
};
|
2020-05-20 20:16:32 +00:00
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
}
|