Coder Social home page Coder Social logo

Comments (1)

mrfijas avatar mrfijas commented on August 28, 2024

hi, wanted to create issue with sampling and array join, but I believe it would be a duplicate of this issue..
I'm using clickhouse-sqlalchemy==0.1.8 and

from sqlalchemy.sql.ddl import CreateTable

from clickhouse_sqlalchemy import engines, types, get_declarative_base, make_session
from sqlalchemy import create_engine, MetaData, Column

from clickhouse_sqlalchemy.drivers.base import ClickHouseDialect, clickhouse_dialect

uri = 'clickhouse+native://default:default@clickhouse:9000'

engine = create_engine(uri)
session = make_session(engine)
metadata = MetaData(bind=engine)

Base = get_declarative_base(metadata=metadata)


class Table(Base):
    id = Column(types.UInt32(), primary_key=True)
    arr = Column(types.Array(types.String))
    __table_args__ = (
        engines.MergeTree(
            order_by="id",
            sample_by="id",
        ),
    )


# print(CreateTable(Table.__table__).compile(dialect=clickhouse_dialect))

q = session.query(Table.arr).sample(0.2).array_join(Table.arr)
print(q.statement.compile(dialect=clickhouse_dialect))

was producing

SELECT "table".arr 
FROM "table" 
ARRAY JOIN "table".arr 
SAMPLE %(param_1)s

instead of

SELECT "table".arr 
FROM "table"
SAMPLE %(param_1)s
ARRAY JOIN "table".arr

when wanted to check it with latest 0.2.2 I got

SELECT "table".arr 
FROM "table"

with no ARRAY JOIN nor SAMPLE.

  1. what am I doing wrong?
  2. is sampling supported when using array join?

from clickhouse-sqlalchemy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.