Skip to main content

Module relational

Module relational 

Source
Expand description

Schema inference for the relational (external table) engine: connects to a remote MySQL database and maps its column types to GreptimeDB ConcreteDataTypes at CREATE EXTERNAL TABLE time.

Types that cannot be mapped faithfully (e.g. BIT, spatial types, a DECIMAL wider than 38 digits, or TIME) are rejected rather than silently degraded. A few types map with documented caveats โ€” DATETIME and TIMESTAMP lose their timezone semantics (see map_timestamp).

Structsยง

MySqlColumn
A remote column read from INFORMATION_SCHEMA.COLUMNS, before its type is mapped to a GreptimeDB ConcreteDataType.
MySqlColumnType
A MySQL column type as reported by INFORMATION_SCHEMA.COLUMNS.
RelationalColumn
A remote column already mapped to a GreptimeDB ConcreteDataType.

Constantsยง

CONNECT_TIMEOUT ๐Ÿ”’
Connect + handshake timeout for CREATE EXTERNAL TABLE; a silently dropping host would otherwise hang the DDL until the OS timeout.
QUERY_TIMEOUT ๐Ÿ”’

Functionsยง

box_foreign_error ๐Ÿ”’
Boxes a foreign driver error into a [BoxedError]. 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.
box_timeout_error ๐Ÿ”’
build_mysql_opts ๐Ÿ”’
Parses the connection DSN and, for TCP connections, resolves the host to candidate IP addresses. When an explicit Unix socket is configured (?socket=/path), mysql_async dials the socket path directly, so the host is a placeholder and DNS resolution is skipped entirely.
fetch_mysql_columns
Connects to the remote MySQL instance and reads the column list of remote_table from INFORMATION_SCHEMA.COLUMNS. Each column keeps its driver-reported type, so callers decide which columns to map to a GreptimeDB ConcreteDataType.
map_decimal ๐Ÿ”’
map_mysql_column_type
Maps a MySQL column type to a GreptimeDB ConcreteDataType.
map_mysql_columns
Maps raw MySQL columns to GreptimeDB ConcreteDataTypes via map_mysql_column_type.
map_timestamp ๐Ÿ”’
parse_host_literal ๐Ÿ”’
Parses host as a literal IP address, stripping the URL-level brackets that wrap an IPv6 literal (e.g. [::1] โ†’ ::1). Returns None when host is a hostname rather than a literal.
resolve_host_ips ๐Ÿ”’
Resolves host 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.
split_remote_table ๐Ÿ”’
Splits remote_table into an optional schema qualifier and the bare table name: "schema.table" โ†’ (Some("schema"), "table"), "table" โ†’ (None, "table").
unsupported ๐Ÿ”’

Type Aliasesยง

RawColumnRow ๐Ÿ”’
A raw INFORMATION_SCHEMA.COLUMNS row decoded by the driver: (name, data_type, column_type, precision, scale, fsp).