在clickhouse客户机中执行SELECT * FROM test_table;
时,我得到了N行,但在使用sqlalchemy的python代码中执行engine.execute('SELECT * FROM test_table;')
时只有N-2行。你知道吗
复制步骤:
CREATE TABLE test_table (id INTEGER, created Date) ENGINE = MergeTree(created, (id), 8192);
INSERT INTO test_table (id, created) VALUES (1, 11345678);
INSERT INTO test_table (id, created) VALUES (2, 12345678);
INSERT INTO test_table (id, created) VALUES (3, 13345678);
INSERT INTO test_table (id, created) VALUES (4, 14345678);
SELECT * FROM test_table;
结果:
SELECT *
FROM test_table
┌─id─┬────created─┐
│ 4 │ 2106-02-07 │
└────┴────────────┘
┌─id─┬────created─┐
│ 3 │ 2084-08-20 │
└────┴────────────┘
┌─id─┬────created─┐
│ 2 │ 2038-03-15 │
└────┴────────────┘
┌─id─┬────created─┐
│ 1 │ 1991-10-08 │
└────┴────────────┘
4 rows in set. Elapsed: 0.004 sec.
好的,按预期4排。你知道吗
from sqlalchemy import create_engine
connection_string = 'clickhouse://default:@localhost/default'
engine = create_engine(connection_string)
result = list(engine.execute('SELECT * FROM test_table;'))
print(len(result))
print(result)
结果:
2
[('4', '2106-02-07'), ('2', '2038-03-15')]
绝对不像预期的那样。那么,这是怎么回事?你知道吗
sqlalchemy版本:1.3.11
clickhouse版本(服务器和客户端):19.17.4.11
目前没有回答
相关问题 更多 >
编程相关推荐