Comments (8)
Пофиксил в последнем master.
from clickhouse-sqlalchemy.
Привет.
Да, это сломалось при рефакторинге. В качестве workaround можно вызывать .fetchall()
. С ним порядок сохраняется и в новых версиях.
from sqlalchemy import create_engine, text
from sqlalchemy.orm import sessionmaker
uri = 'clickhouse+http://default:@localhost'
engine = create_engine(uri)
Session = sessionmaker()
Session.configure(bind=engine)
session = Session()
print(list(session.execute('select * from system.numbers limit 5').fetchall()))
[(0,), (1,), (2,), (3,), (4,)]
Почему вы используете http-диалект вместо native-диалекта?
from clickhouse-sqlalchemy.
Открыт порт только на http подключение.
В следующем релизе, можно ли ожидать исправление данного поведение с fetchone
?
Помимо трафика, у native-диалекта есть еще преимущества над http?
from clickhouse-sqlalchemy.
Да, в следующем релизе это будет исправлено.
Если таскать большое количество данных между клиентом и сервером, то native лучше с точки зрения производительности (массив int-ов бинарно (де)сериализуется быстрее, чем в текст). Если данных между клиентом и сервером немного путешествует, то разницы в общем-то немного. Руки никак не дойдут сделать их сравнение.
from clickhouse-sqlalchemy.
Спасибо за развернутый ответ!
from clickhouse-sqlalchemy.
прошу прощение за бестактность.
на мой взгляд row.pop(0)
будет медленнее чем row = row[::-1]; row.pop()
.
from clickhouse-sqlalchemy.
Да, конечно, второй вариант будет быстрее. Подумаю над его возвращением.
from clickhouse-sqlalchemy.
Немного поэкспериментировал row.pop(0)
будет быстрее для небольших данных (до 40_000):
for 1_000_000
python -m timeit -r 1 -u msec -s 'l = list(range(1_000_000))' 'while len(l) > 0: l.pop(0)'
10 loops, best of 1: 5.24e+04 msec per loop
python -m timeit -r 1 -u msec -s 'l = list(range(1_000_000))' 'l = l[::-1]' 'while len(l) > 0: l.pop()'
1000000 loops, best of 1: 0.000296 msec per loop
for 1_000
python -m timeit -r 1 -u usec -s 'l = list(range(1_000))' 'while len(l) > 0: l.pop(0)'
10000000 loops, best of 1: 0.0675 usec per loop
python -m timeit -r 1 -u usec -s 'l = list(range(1_000))' 'l = l[::-1]' 'while len(l) > 0: l.pop()'
10000000 loops, best of 1: 0.141 usec per loop
from clickhouse-sqlalchemy.
Related Issues (20)
- Does `clickhouse-sqlalchemy` 3.0.0 support `sqlalchemy` of the version 1.4.*? HOT 5
- Create a cluster table orm class with engines.Distributed which has a logs attribute, how to use variable to indicate it?
- alembic does not autogenerate engine for clickhouse table HOT 4
- Patreon does not work HOT 1
- Add support for Date32 HOT 2
- Handling Clickhouse Alembic Migrations for Clickhouse cluster HOT 2
- Support/example for creating views HOT 2
- `create_all` for all the `MaterializedView`
- With chdb this clickhouse downsized memory database, can clickhouse-sqlalchemy support it or not?
- Support VariantType
- Table reflection for DateTime64 timezone will be extra quoted
- Alembic_Version Records disappered after clickhouse alembic migration HOT 5
- using http mode, connecting database failed when account password ends with @ HOT 2
- Support nested Map column
- Cannot seem to run ALTER command on replicas of the same shard HOT 2
- Sqlalchemy can't catch asynch's error
- query_id cannot be set with the native TCP connection
- Feature Request: Support clickhouse-connect's NEW AsyncClient wrapper HOT 5
- Nested maps, tuples, enums don't work HOT 2
- Support Lightweight DELETE Statement HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clickhouse-sqlalchemy.