Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor execution not including names and types #12

Closed
AchilleAsh opened this issue Feb 13, 2018 · 2 comments
Closed

Cursor execution not including names and types #12

AchilleAsh opened this issue Feb 13, 2018 · 2 comments

Comments

@AchilleAsh
Copy link
Contributor

Hi,

I've started to play with your lib and I've noticed one major bug when using the HTTP driver:

When calling the execute() method of a Cursor the SQL will not be appended with ' FORMAT TabSeparatedWithNamesAndTypes' as you could initially expect from the drivers/http/base.py file. This causes the result not to include the columns name and therefore the TSV post processing
(drivers/http/connector.py#195) will go wrong because the first 2 rows are actually data samples.

It seems to me that the following method of ClickHouseDialect_http

    def _execute(self, connection, sql):
        sql += ' FORMAT TabSeparatedWithNamesAndTypes'
        return connection.execute(sql)

is actually never called (Cursor or not), but I could be wrong.

One quick and easy fix could be to move this to the execute() method of Cursor.

Thanks,
Timothé

@xzkostyan
Copy link
Owner

Hi,

Yes, there is bug in direct HTTP cursor's execute() invocation. Native driver hasn't this disadvantage.

FORMAT clause was illegal in some queries as I remember. That's why this hack is located in two places. May be this situation is changed now.

In future I intend to switch default driver from http to native and maybe drop http support.

@xzkostyan
Copy link
Owner

It seems that this was fixed in #134.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants