GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - castengine/insert-tools: CLI tool for inserting SELECT query results into ClickHouse with automatic schema matching and type-safe casting. Ideal for ETL pipelines and SQL-driven data flows.

BranchesTags
Open more actions menu

Latest commit

 

History

26 Commits
26 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
clickhouse_insert
clickhouse_insert
 
 
examples
examples
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE_COMMERCIAL.md
LICENSE_COMMERCIAL.md
 
 
LICENSE_NONCOMMERCIAL.md
LICENSE_NONCOMMERCIAL.md
 
 
MANIFEST.in
MANIFEST.in
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
config.json
config.json
 
 
docker-compose.yml
docker-compose.yml
 
 
pyproject.toml
pyproject.toml
 
 
requirements-dev.txt
requirements-dev.txt
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

๐Ÿš€ Insert Tools

PyPI version Python Versions Downloads GitHub Workflow Status License: Non-commercial License: Commercial Last commit Stars

Problem:

Have you faced issues inserting data into databases? Constant schema mismatch errors, incorrect data types, manual checks, and even silent data corruption? If you work with large ETL pipelines and databases, you know how painful it can be.

Solution:

Insert Tools is a robust and flexible tool designed for safe and fast data insertion into databases โ€” starting with ClickHouse. It validates schema by column names (not by order), supports automatic type casting, and lets you dry-run your inserts before touching real data. Perfect for ETL pipelines where target table schemas evolve frequently.

๐Ÿ”ฅ Why you should try it:

  • โœ… Data safety: Validates column names and types before insert.
  • โš™๏ธ Auto type casting: Converts mismatched types when enabled.
  • ๐Ÿšง Dry-run mode: Test inserts without touching data.
  • ๐Ÿณ Docker-ready: Comes with ready-to-use Docker integration.
  • ๐Ÿ”ง Configurable: Fully controllable insert pipeline.
  • ๐Ÿ”ฅ Time saver: Automates validation and error prevention.

๐ŸŽฏ Key Features:

  • ๐Ÿ–ฅ๏ธ Simple CLI and Python API.
  • ๐Ÿ›ก๏ธ Strict mode to block extra columns.
  • ๐Ÿ“Œ Detailed logging and diagnostics.
  • ๐Ÿ”„ Easy CI/CD integration.

๐Ÿ“ฆ Quick install:

pip install insert-tools

To install for development:

pip install -e .[dev]

Link to the project on PyPI

๐Ÿš€ Run & Examples:

๐Ÿ Python usage:

from insert_tools.runner import InsertConfig, run_insert

config = InsertConfig(
    host="localhost",
    database="default",
    target_table="my_table",
    select_sql="SELECT * FROM source_table",
    user="default",
    password="admin123",
    allow_type_cast=True,
    strict_column_match=True
)

run_insert(config)

๐Ÿ–ฅ๏ธ CLI usage:

insert-tools \
  --host localhost \
  --port 8123 \
  --user default \
  --password admin123 \
  --database default \
  --target_table my_table \
  --select_sql "SELECT * FROM source_table" \
  --allow_type_cast \
  --strict \
  --dry-run \
  --verbose

๐Ÿงช Testing & Integration:

pytest -v --cov=insert_tools tests/

Integration tests are supported via Docker (docker-compose.yml).

๐Ÿ“ˆ Roadmap:

Planned and upcoming features:

โœ… Core & Safety

  • ClickHouse support (stable)
  • Manual insert_columns mapping
  • Logging configuration (file, level, formatting)
  • Dry-run + exit codes
  • Strict schema validator with preview

๐Ÿ“ฆ Priority Database Support

  • MySQL โ€” no name-based insert, requires exact column order
  • PostgreSQL โ€” order and column count must match
  • SQLite โ€” insert depends on column order
  • Oracle โ€” insert requires explicit column mapping
  • SQL Server โ€” insert must follow column order

๐Ÿงฐ Advanced Features

  • Error handling strategies (fail, warn, skip)
  • Config file validation (optional)
  • Secure secrets handling (.env / vault)
  • Optional CAST rules config

๐Ÿ“˜ Ecosystem

  • Full documentation site (mkdocs)
  • Schema + config reference
  • Auto-generated help from CLI
  • GitHub Discussions / Community page

๐Ÿ› ๏ธ Configuration Options

Parameter Description Required
host ClickHouse server hostname โœ…
port ClickHouse server port โŒ
user ClickHouse user โŒ
password ClickHouse password โŒ
database Target database โœ…
target_table Target table name โœ…
select_sql SQL query to fetch data โœ…
allow_type_cast Allow type casting on mismatch โŒ
strict_column_match Enable strict mode for column matching โŒ

๐Ÿงฑ How It Works

  1. Fetches target table schema from ClickHouse.
  2. Extracts column names and types from SELECT query.
  3. Applies optional CAST(...) if types mismatch.
  4. Validates column alignment and inserts data.

๐Ÿค Contributing:

Ideas, bug reports, and pull requests are welcome! Join the community and help make Insert Tools better.

โš–๏ธ License

This project uses a dual-license model:

  • ๐Ÿ†“ Non-commercial license โ€” free to use for personal, educational, and internal non-commercial purposes. See LICENSE_NONCOMMERCIAL.md
  • ๐Ÿ’ผ Commercial license โ€” required for any commercial use. See LICENSE_COMMERCIAL.md or contact [email protected] for licensing terms.

Insert Tools makes data insertion simple, fast, and safe. Save your time and nerves today!

About

CLI tool for inserting SELECT query results into ClickHouse with automatic schema matching and type-safe casting. Ideal for ETL pipelines and SQL-driven data flows.

Topics

bulk-insertcastcliclickhousedata-toolsdatabasedevtoolsetletl-pipelineinsertopen-sourcepythonschema-matchingsql

Resources

Readme
License

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

7 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.