Documentation
¶
Index ¶
- func Load(ctx context.Context, params LoadParams) (int64, error)
- func Save(ctx context.Context, params SaveParams) (int64, error)
- type ClickHouseDriver
- func (d *ClickHouseDriver) ArrowType(dt arrow.DataType) (string, error)
- func (d *ClickHouseDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
- func (d *ClickHouseDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, ...) error
- func (d *ClickHouseDriver) DefaultSchema() string
- func (d *ClickHouseDriver) DropTable(ctx context.Context, db *sql.DB, schema, table string) error
- func (d *ClickHouseDriver) QuoteIdentifier(name string) string
- func (d *ClickHouseDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
- func (d *ClickHouseDriver) TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
- type Driver
- type LoadMode
- type LoadParams
- type MSSQLDriver
- func (d *MSSQLDriver) ArrowType(dt arrow.DataType) (string, error)
- func (d *MSSQLDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
- func (d *MSSQLDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, ...) error
- func (d *MSSQLDriver) DefaultSchema() string
- func (d *MSSQLDriver) DropTable(ctx context.Context, db *sql.DB, schema, table string) error
- func (d *MSSQLDriver) QuoteIdentifier(name string) string
- func (d *MSSQLDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
- func (d *MSSQLDriver) TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
- type OracleDriver
- func (d *OracleDriver) ArrowType(dt arrow.DataType) (string, error)
- func (d *OracleDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
- func (d *OracleDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, ...) error
- func (d *OracleDriver) DefaultSchema() string
- func (d *OracleDriver) DropTable(ctx context.Context, db *sql.DB, schema, table string) error
- func (d *OracleDriver) QuoteIdentifier(name string) string
- func (d *OracleDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
- func (d *OracleDriver) TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
- type PostgresDriver
- func (d *PostgresDriver) ArrowType(dt arrow.DataType) (string, error)
- func (d *PostgresDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
- func (d *PostgresDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, ...) error
- func (d *PostgresDriver) DefaultSchema() string
- func (d *PostgresDriver) DropTable(ctx context.Context, db *sql.DB, schema, table string) error
- func (d *PostgresDriver) QuoteIdentifier(name string) string
- func (d *PostgresDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
- func (d *PostgresDriver) TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
- type SaveParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClickHouseDriver ¶
type ClickHouseDriver struct{}
ClickHouseDriver implements the Driver interface for ClickHouse.
func (*ClickHouseDriver) ArrowType ¶
func (d *ClickHouseDriver) ArrowType(dt arrow.DataType) (string, error)
ArrowType maps an Arrow data type to a ClickHouse column type string.
func (*ClickHouseDriver) BulkLoad ¶
func (d *ClickHouseDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
BulkLoad streams Arrow record batches into a ClickHouse table using batch inserts. The clickhouse-go driver accumulates rows in the prepared statement and sends them as a batch on tx.Commit().
func (*ClickHouseDriver) CreateTable ¶
func (d *ClickHouseDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, arrowSchema *arrow.Schema) error
CreateTable creates a table in the database from an Arrow schema.
func (*ClickHouseDriver) DefaultSchema ¶
func (d *ClickHouseDriver) DefaultSchema() string
DefaultSchema returns an empty string; ClickHouse uses databases, not schemas.
func (*ClickHouseDriver) QuoteIdentifier ¶
func (d *ClickHouseDriver) QuoteIdentifier(name string) string
QuoteIdentifier wraps a name in backtick quoting for ClickHouse.
func (*ClickHouseDriver) SQLTypeToArrow ¶
func (d *ClickHouseDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
SQLTypeToArrow maps a ClickHouse type name to an Arrow data type.
func (*ClickHouseDriver) TruncateTable ¶
func (d *ClickHouseDriver) TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
TruncateTable truncates a table.
type Driver ¶
type Driver interface {
BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
CreateTable(ctx context.Context, db *sql.DB, schema, table string, arrowSchema *arrow.Schema) error
DropTable(ctx context.Context, db *sql.DB, schema, table string) error
TruncateTable(ctx context.Context, db *sql.DB, schema, table string) error
ArrowType(dt arrow.DataType) (string, error)
SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
DefaultSchema() string
QuoteIdentifier(name string) string
}
Driver abstracts database-specific bulk load and DDL operations.
type LoadParams ¶
type LoadParams struct {
FilePath string // path to the Parquet file
Table string // target table name
Schema string // target schema (default depends on driver)
Mode LoadMode // append, truncate_and_load, or create_or_replace
ConnStr string // database connection string
}
LoadParams configures a data load operation.
type MSSQLDriver ¶
type MSSQLDriver struct{}
MSSQLDriver implements the Driver interface for Microsoft SQL Server.
func (*MSSQLDriver) ArrowType ¶
func (d *MSSQLDriver) ArrowType(dt arrow.DataType) (string, error)
ArrowType maps an Arrow data type to a MSSQL column type string.
func (*MSSQLDriver) BulkLoad ¶
func (d *MSSQLDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
BulkLoad streams Arrow record batches from the parquetStream into an MSSQL table. Only one row group's worth of data is held in memory at a time.
func (*MSSQLDriver) CreateTable ¶
func (d *MSSQLDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, arrowSchema *arrow.Schema) error
CreateTable creates a table in the database from an Arrow schema.
func (*MSSQLDriver) DefaultSchema ¶
func (d *MSSQLDriver) DefaultSchema() string
DefaultSchema returns the default schema for MSSQL.
func (*MSSQLDriver) QuoteIdentifier ¶
func (d *MSSQLDriver) QuoteIdentifier(name string) string
QuoteIdentifier wraps a name in MSSQL bracket-quoting.
func (*MSSQLDriver) SQLTypeToArrow ¶
func (d *MSSQLDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
SQLTypeToArrow maps a database type name to an Arrow data type.
func (*MSSQLDriver) TruncateTable ¶
TruncateTable truncates a table.
type OracleDriver ¶
type OracleDriver struct{}
OracleDriver implements the Driver interface for Oracle Database.
func (*OracleDriver) ArrowType ¶
func (d *OracleDriver) ArrowType(dt arrow.DataType) (string, error)
ArrowType maps an Arrow data type to an Oracle column type string.
func (*OracleDriver) BulkLoad ¶
func (d *OracleDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
BulkLoad streams Arrow record batches into an Oracle table using prepared statements with Oracle bind variables (:1, :2, ...) within a transaction.
func (*OracleDriver) CreateTable ¶
func (d *OracleDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, arrowSchema *arrow.Schema) error
CreateTable creates a table in the database from an Arrow schema.
func (*OracleDriver) DefaultSchema ¶
func (d *OracleDriver) DefaultSchema() string
DefaultSchema returns an empty string; Oracle derives the schema from the connection user.
func (*OracleDriver) DropTable ¶
DropTable drops a table if it exists using PL/SQL to suppress ORA-00942.
func (*OracleDriver) QuoteIdentifier ¶
func (d *OracleDriver) QuoteIdentifier(name string) string
QuoteIdentifier wraps a name in double-quote identifiers with upper-casing for Oracle.
func (*OracleDriver) SQLTypeToArrow ¶
func (d *OracleDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
SQLTypeToArrow maps an Oracle database type name to an Arrow data type.
func (*OracleDriver) TruncateTable ¶
TruncateTable truncates a table.
type PostgresDriver ¶
type PostgresDriver struct{}
PostgresDriver implements the Driver interface for PostgreSQL.
func (*PostgresDriver) ArrowType ¶
func (d *PostgresDriver) ArrowType(dt arrow.DataType) (string, error)
ArrowType maps an Arrow data type to a PostgreSQL column type string.
func (*PostgresDriver) BulkLoad ¶
func (d *PostgresDriver) BulkLoad(ctx context.Context, db *sql.DB, params LoadParams, stream *parquetStream) (int64, error)
BulkLoad streams Arrow record batches into a PostgreSQL table using pgx COPY protocol. It opens a separate pgx native connection for the COPY operation (the db *sql.DB param is used by the shared Load() caller for DDL but is not needed here).
func (*PostgresDriver) CreateTable ¶
func (d *PostgresDriver) CreateTable(ctx context.Context, db *sql.DB, schema, table string, arrowSchema *arrow.Schema) error
CreateTable creates a table in the database from an Arrow schema.
func (*PostgresDriver) DefaultSchema ¶
func (d *PostgresDriver) DefaultSchema() string
DefaultSchema returns the default schema for PostgreSQL.
func (*PostgresDriver) QuoteIdentifier ¶
func (d *PostgresDriver) QuoteIdentifier(name string) string
QuoteIdentifier wraps a name in double-quote identifiers for PostgreSQL.
func (*PostgresDriver) SQLTypeToArrow ¶
func (d *PostgresDriver) SQLTypeToArrow(dbTypeName string) (arrow.DataType, error)
SQLTypeToArrow maps a PostgreSQL type name to an Arrow data type.
func (*PostgresDriver) TruncateTable ¶
TruncateTable truncates a table.
type SaveParams ¶
type SaveParams struct {
Query string // SQL SELECT query
FilePath string // output Parquet file path
ConnStr string // database connection string
}
SaveParams configures a query-to-Parquet save operation.