Skip to content

Instantly share code, notes, and snippets.

View subkanthi's full-sized avatar

Kanthi subkanthi

View GitHub Profile
@subkanthi
subkanthi / gist:1bfca48432ec25a48b6bda569cf879b4
Created November 16, 2023 19:05
Sink connector timezone, MySQL(CST) , ClickHouse(America/Chicago)
mysql> INSERT INTO `temporal_types_DATETIME6` VALUES ('DATETIME(6)','1000-01-01 00:00:00.000000','2022-09-29 01:50:56.123456','9999-12-31 23:59:59.999999',NULL);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO `temporal_types_DATETIME6` VALUES ('DATETIME(6)','1000-01-01 00:00:00.000000','2022-09-29 01:50:56.123456','9999-12-31 23:59:59.999999',NULL);
Query OK, 1 row affected (0.00 sec)
b614a4f66bd5 :) select * from temporal_types_DATETIME6;
SELECT *
FROM temporal_types_DATETIME6
@subkanthi
subkanthi / date_limits.sql
Last active November 13, 2023 16:03
ClickHouse Date & Date32 limits
// Clickhouse server version 23.2.4 revision 54461.
CREATE TABLE dt
(
`timestamp` Date,
`event_id` UInt8
)
ENGINE = TinyLog
a6382f28c85d :) INSERT INTO dt VALUES ('1925-01-01', 1);
@subkanthi
subkanthi / modify_column.sql
Last active April 11, 2023 18:26
Modify column clickhouse (NULL not retained unless specified) vs MySQL
create table test_modify(uid String, newcol Nullable(String)) Engine=MergeTree() order by uid;
CREATE TABLE test_modify
(
`uid` String,
`newcol` Nullable(String)
)
ENGINE = MergeTree
ORDER BY uid
@subkanthi
subkanthi / session_example.java
Last active March 22, 2023 22:26
Sessions in Clickhouse JDBC (0.3.2-patch11)
// https://github.com/ClickHouse/ClickHouse/blob/58db4b7be4f326f5c30dccf3372172d83912f282/dbms/tests/queries/0_stateless/00463_sessions_in_http_interface.sh
// Pass a unique id to session_id and open a new connection.
ClickHouseDataSource dataSource = new ClickHouseDataSource(url + "?session_id=1", properties);
ClickHouseConnection conn = dataSource.getConnection(userName, "");
dataSource.getConnection().prepareStatement("set max_rows_to_read=7777777").execute();
// Set the setting - max_rows_to_read
ResultSet rs = dataSource.getConnection().prepareStatement("select * from system.settings where name='max_rows_to_read'").executeQuery();
@subkanthi
subkanthi / docker-compose.yaml
Created January 10, 2023 03:54
sink connector(basic components without monitoring)
version: "3.4"
# Ubuntu , set this for redpanda to start
# https://sort.veritas.com/public/documents/HSO/2.0/linux/productguides/html/hfo_admin_ubuntu/ch04s03.htm
# Clickhouse Table Schema
# create table test(id int, message String) ENGINE=MergeTree() PRIMARY KEY id;
services:
mysql-master: