mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-30 22:54:12 +00:00
24 lines
11 KiB
HTML
24 lines
11 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Schema inference for the relational (external table) engine: connects to a remote MySQL database and maps its column types to GreptimeDB `ConcreteDataType`s at `CREATE EXTERNAL TABLE` time."><title>operator::relational - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="operator" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module relational</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../operator/index.html">operator</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module relational</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate operator</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">operator</a></div><h1>Module <span>relational</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/operator/relational.rs.html#15-616">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Schema inference for the relational (external table) engine: connects to a
|
|
remote MySQL database and maps its column types to GreptimeDB
|
|
<a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>s at <code>CREATE EXTERNAL TABLE</code> time.</p>
|
|
<p>Types that cannot be mapped faithfully (e.g. <code>BIT</code>, spatial types, a
|
|
<code>DECIMAL</code> wider than 38 digits, or <code>TIME</code>) are rejected rather than
|
|
silently degraded. A few types map with documented caveats — <code>DATETIME</code>
|
|
and <code>TIMESTAMP</code> lose their timezone semantics (see <code>map_timestamp</code>).</p>
|
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.MySqlColumn.html" title="struct operator::relational::MySqlColumn">MySql<wbr>Column</a></dt><dd>A remote column read from <code>INFORMATION_SCHEMA.COLUMNS</code>, before its type is
|
|
mapped to a GreptimeDB <a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>.</dd><dt><a class="struct" href="struct.MySqlColumnType.html" title="struct operator::relational::MySqlColumnType">MySql<wbr>Column<wbr>Type</a></dt><dd>A MySQL column type as reported by <code>INFORMATION_SCHEMA.COLUMNS</code>.</dd><dt><a class="struct" href="struct.RelationalColumn.html" title="struct operator::relational::RelationalColumn">Relational<wbr>Column</a></dt><dd>A remote column already mapped to a GreptimeDB <a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.CONNECT_TIMEOUT.html" title="constant operator::relational::CONNECT_TIMEOUT">CONNECT_<wbr>TIMEOUT</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Connect + handshake timeout for <code>CREATE EXTERNAL TABLE</code>; a silently
|
|
dropping host would otherwise hang the DDL until the OS timeout.</dd><dt><a class="constant" href="constant.QUERY_TIMEOUT.html" title="constant operator::relational::QUERY_TIMEOUT">QUERY_<wbr>TIMEOUT</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.box_foreign_error.html" title="fn operator::relational::box_foreign_error">box_<wbr>foreign_<wbr>error</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Boxes a foreign driver error into a [<code>BoxedError</code>]. The message is scrubbed:
|
|
if the driver echoes the connection DSN (which carries the password), it is
|
|
replaced by its redacted form so credentials never leak.</dd><dt><a class="fn" href="fn.box_timeout_error.html" title="fn operator::relational::box_timeout_error">box_<wbr>timeout_<wbr>error</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.build_mysql_opts.html" title="fn operator::relational::build_mysql_opts">build_<wbr>mysql_<wbr>opts</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Parses the connection DSN and, for TCP connections, resolves the host to
|
|
candidate IP addresses. When an explicit Unix socket is configured
|
|
(<code>?socket=/path</code>), mysql_async dials the socket path directly, so the host
|
|
is a placeholder and DNS resolution is skipped entirely.</dd><dt><a class="fn" href="fn.fetch_mysql_columns.html" title="fn operator::relational::fetch_mysql_columns">fetch_<wbr>mysql_<wbr>columns</a></dt><dd>Connects to the remote MySQL instance and reads the column list of
|
|
<code>remote_table</code> from <code>INFORMATION_SCHEMA.COLUMNS</code>. Each column keeps its
|
|
driver-reported type, so callers decide which columns to map to a
|
|
GreptimeDB <a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>.</dd><dt><a class="fn" href="fn.map_decimal.html" title="fn operator::relational::map_decimal">map_<wbr>decimal</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.map_mysql_column_type.html" title="fn operator::relational::map_mysql_column_type">map_<wbr>mysql_<wbr>column_<wbr>type</a></dt><dd>Maps a MySQL column type to a GreptimeDB <a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>.</dd><dt><a class="fn" href="fn.map_mysql_columns.html" title="fn operator::relational::map_mysql_columns">map_<wbr>mysql_<wbr>columns</a></dt><dd>Maps raw MySQL columns to GreptimeDB <a href="../../datatypes/data_type/enum.ConcreteDataType.html" title="enum datatypes::data_type::ConcreteDataType"><code>ConcreteDataType</code></a>s via
|
|
<a href="fn.map_mysql_column_type.html" title="fn operator::relational::map_mysql_column_type"><code>map_mysql_column_type</code></a>.</dd><dt><a class="fn" href="fn.map_timestamp.html" title="fn operator::relational::map_timestamp">map_<wbr>timestamp</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.parse_host_literal.html" title="fn operator::relational::parse_host_literal">parse_<wbr>host_<wbr>literal</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Parses <code>host</code> as a literal IP address, stripping the URL-level brackets that
|
|
wrap an IPv6 literal (e.g. <code>[::1]</code> → <code>::1</code>). Returns <code>None</code> when <code>host</code> is a
|
|
hostname rather than a literal.</dd><dt><a class="fn" href="fn.resolve_host_ips.html" title="fn operator::relational::resolve_host_ips">resolve_<wbr>host_<wbr>ips</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Resolves <code>host</code> to the full list of IP addresses the TCP dial should try, so
|
|
a host backed by several A/AAAA records can fall back when one is unreachable.</dd><dt><a class="fn" href="fn.split_remote_table.html" title="fn operator::relational::split_remote_table">split_<wbr>remote_<wbr>table</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Splits <code>remote_table</code> into an optional schema qualifier and the bare table
|
|
name: <code>"schema.table"</code> → <code>(Some("schema"), "table")</code>, <code>"table"</code> → <code>(None, "table")</code>.</dd><dt><a class="fn" href="fn.unsupported.html" title="fn operator::relational::unsupported">unsupported</a><span title="Restricted Visibility"> 🔒</span> </dt></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.RawColumnRow.html" title="type operator::relational::RawColumnRow">RawColumn<wbr>Row</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>A raw <code>INFORMATION_SCHEMA.COLUMNS</code> row decoded by the driver:
|
|
(<code>name</code>, <code>data_type</code>, <code>column_type</code>, <code>precision</code>, <code>scale</code>, <code>fsp</code>).</dd></dl></section></div></main></body></html> |