Skip to content

Inserting to variant containing String will lead to only String being inserted #534

@SkytAsul

Description

@SkytAsul

Describe the bug

If I correctly understood, currently ClickHouse-connect passes Variant data as String so ClickHouse server infers the type by itself. However, if the Variant contains the String type (e.g. Variant(Int64, Float32, String)), all data will be inserted as String.

Steps to reproduce

  1. Create a table containing a Variant(Int64, Float32, String) column
  2. Insert some int or float data using ClickHouse-connect
  3. Run SELECT variantType(yourColumn) and see that all rows have String type

Expected behaviour

The correct type is kept

Configuration

Environment

  • clickhouse-connect version: 0.8.18
  • Python version: 3.12.3

ClickHouse server

  • ClickHouse Server version: 25.7.1
  • ClickHouse Server non-default settings, if any:
"profile","max_threads","1"
"profile","log_queries","1"
"profile","log_queries_min_type","QUERY_FINISH"
"profile","log_queries_min_query_duration_ms","0"
"profile","log_queries_cut_to_length","10000"
"profile","http_max_field_value_size","262144"
"profile","allow_introspection_functions","1"
"profile","use_query_cache","0"
"profile","query_cache_nondeterministic_function_handling","ignore"
"profile","query_cache_system_table_handling","ignore"
"profile","query_cache_min_query_runs","2"
"profile","query_cache_min_query_duration","100"
"profile","query_cache_ttl","30"
"profile","use_query_condition_cache","0"
"server","max_thread_pool_size","10000"
"server","default_database","default"
"server","max_server_memory_usage","30281777971"
"server","max_server_memory_usage_to_ram_ratio","0.9"
"server","max_concurrent_queries","1000"
"server","uncompressed_cache_size","8589934592"
"server","query_condition_cache_size","106700800"
"server","concurrent_threads_soft_limit_num","0"
"server","concurrent_threads_soft_limit_ratio_to_cores","2"
"server","concurrent_threads_scheduler","fair_round_robin"
"server","async_load_databases","1"
"server","keep_alive_timeout","10"
"server","total_memory_profiler_step","4194304"
"server","total_memory_tracker_sample_probability","0"
"server","validate_tcp_client_information","0"
"server","global_profiler_real_time_period_ns","1000000000"
"server","global_profiler_cpu_time_period_ns","100000000"
"server","dictionaries_lazy_load","1"
"server","wait_dictionaries_load_at_startup","1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions