Files
connect/playtest.py
+5 9270ce347a Allows connect to server version 19.16.19.85 (#140)
* Additional table engine definitions

* Add directory, fix test

* More distribution updates

* Add passthrough of connection options, clean up TLS settigns

* Replaced all dict typing with Dict

* Replaced all dict typing with Dict

* Fix SqlAlchemy table exists method

* Workflows (#5)

* Add first test workflow

* Fix cache typo

* Try to fix python setup

* Fix another typo

* Fix cache

* requirements.txt?

* Hack superset directories

* Hack superset dependencies

* Fix another typo

* Fix Jinja dependency

* More mucking with test dependencies

* Build cython extensions in tests

* Attempt to fix cython build

* Hack for old Python IPv6Addresses

* Exclude Python 3.7 from tests because Superset

* Don't test Date32 (not supported in CH 21.8)

* Make tests work with ClickHouse 21.8

* Exclude Python 3.10 from tests temporarily

* Skip multiple test runs on pull request

* Add workflow for publish releases to PyPI (#6)

* Cleaning up directories and improving superset testing infrastructure.

* Install dependencies for pylint

* Fix typo

* Testing of release workflow

* Fix typo

* Testing release 1

* Testing release 2

* Testing release 3

* Testing release 4

* Testing release 5

* Testing release 6

* Testing windows

* Testing windows 3

* Testing windows 4

* Testing windows 5

* Test with artifacts

* Test with artifacts 2

* Test with artifacts 3

* Test with artifacts 4

* Test with artifacts 6

* Test with artifacts 7

* Test with artifacts 8

* Test with pypi 1

* Final test

* Final test 2

* Final test 3

* Publish Fixes for PyPI (#7)

* Test new release publish

* Test new release publish 2

* Test new release publish 3

* Test new release publish 4

* Test new release publish 5

* Test new release publish 6

* Test new release publish 7

* Test new release publish 8

* Test new release publish 8

* Test new release publish 9

* Test new release publish 10

* Test new release publish 11

* Test new release publish 12

* Test new release publish 12

* Test new release publish 14

* Test new release publish 15

* Fix Release Issues on PyPI

* Add code to handle LIMIT 0 queries to return names and types (DBT compatibility)

* Add `metadata_only` to query settings to retrieve only column names

* Incorporate PR review comments

* Stop accidentially using root logger

* Add wheel for lint workflow

* Try to make pylint happy

* Add pylint extension

* Stop removing newlines from SQL queries, pin Pylint version

* One more pylint tweak

* Add SQL comment tests

* First work on storing nested elements

* Fix some deprecation, including implicit coercion to float/int for array.array inserts

* Lint fix

* Refactor session params, promote to beta (#12)

* Refactor settings validation and passthrough, promote to Beta status

* Tiny cleanup

* Quiet linter

* Fix non-local test code

* Include separate POST data with client.command (#14)

* One data attempt

* Lint fixes

* More lint fixes

* Send all SQL as POST data for client.command

* Add validation utility for entrypoints

* Fix lint

* Fix timeout and retry issues (#16)

* Only retry queries, not inserts or commands, and use progress headers as keep alive for long running queries

* Ensure string data is encoded as utf8

* Lint fixes

* Add chinese character test

* Decode ClickHouse Error Response to UTF-8 (#19)

* Return ClickHouse error messages as decoded UTF-8

* Return ClickHouse error messages as decoded UTF-8

* Don't try to send readonly settings (even for send_progress or compression) (#20)

* Make sure we don't send read only settings, remove brotli (seems broken), fix ping

* Fix Lint

* Don't modify keyword arguments

* Add socket options for TCP keep alive to HTTP adapter (#21)

* Add socket options for TCP keep alive to HTTP adapter

* Tight up filtering of query parameters/settings that are not server settings

* Fix lint

* Arrow and modest Client method refactoring (#22)

* Add arrow integration step 1

* Fix lint

* Add socket options for TCP keep alive to HTTP adapter

* Tight up filtering of query parameters/settings that are not server settings

* Fix lint

* modest cleanup and refactoring of client methods

* swap abstract method parameters

* Fix arrow doc strings

* Support for Nested columns (#23)

* Checkpoint for nested column support

* Nested column support basic functionality

* Fix lint

* More lint fixes

* Low card fix (#25)

* Fix issues with empty inserts and numeric LowCardinality types

* Checkpoint for nested column support

* Nested column support basic functionality

* Fix lint

* More lint fixes

* Fix issues with empty inserts and LowCardinality numeric types

* Fix lint

* Try to fix tests for ClickHouse 21.8

* Try to fix tests for ClickHouse 21.8 take 2

* Try to fix tests for ClickHouse 21.8 take 3

* Try to fix tests for ClickHouse 21.8 take 5

* Add changelog

* Update changelog

* Include pip installation (#26)

* Format control/JSON/Improvements (#28)

* Format control checkpoint

* Checkpoint on data format handling

* Lint fixes

* Lint fixes

* Format control checkpoint

* Fix lint

* Fix lint

* Format checkpoint

* Fix named tuples

* Named tuple tweaks and test

* Fix lint

* JSON support checkpoint

* Enhance JSON library selection and usage, use QueryContext for all queries

* Fix lint

* Formatting fixes plus more format tests

* Fix lint

* Fix lint

* Expand read format tests

* Fix lint, remove spaces from python JSON serialization

* format doc checkpoint

* Lint fix

* Fix SQL comment related issues

* Fix comment and sqlalchemy issues

* Lint fixes

* Update changelog

* Fix sql comment issues in DBAPI cursor (#29)

* Changelog update

* Zero limit fix (#32)

* Fix sql comment issues in DBAPI cursor

* Fix 0 limit issue.

* Arrow inserts (#33)

* Arrow table inserts, backtick quote all column and table identifiers

* Tweak developer version name

* Remove pip local install

* Update test requirements

* Build cython for lint

* Add raw insert test and identifier quote tweak

* Fix multibyte utf-8 writes (#34)

* added wait_end_of_query in valid_transport_settings (#36)

`SELECT name, value, changed, description, type, readonly FROM system.settings` do not return `wait_end_of_query` setting, so it added in HttpClient.valid_transport_settings

fixes error handling for errors during queries which use `ON CLUSTER` 
https://github.com/ClickHouse/ClickHouse/issues/15124

* Test updates (#37)

* Update test matrix

* First pass at adding cloud tests

* Minor updates, put timestamp first in test database

* Fix DBI cursor, parameterized query fix and updates (#39)

* Fix datetime formatting for parameterization

* Fix cursor description problem with commands, support simple format query strings

* Sqla 1.14 update (#40)

* Fix sqlalchemy 1.4 issue, update superset testing version

* fix typo, update changelog

* Tweak test requirements

* Tweak test requirements

* Tweak test requirements (#42)

* add query_retries client parameter (#43)

* Tweak test requirements

* Add query_retries parameter

* All the wheels (#45)

* Update build and release process checkpoint

* Update build and release process checkpoint

* Update build and release process checkpoint

* Update build and release process checkpoint

* Update build and release process checkpoint

* Update Version

* First cibuildwheel test

* Fix yaml

* Update Version

* Limit test builds

* Update Version

* Test more versions, test pypi upload

* Update Version

* Add macos builds

* Yaml fixes

* Update Version

* Tweak build versions

* Fix yaml

* Update Version

* Add non-x86 linux builds

* Update Version

* Test push only

* Conditional git push to facilitate testing

* More workflow fixes

* Test publish all

* Test publish all

* Test publish all

* Test publish all

* Test publish all

* Update VERSION

* Test publish all

* Test publish all

* Mac OS build test

* Update VERSION

* Test Mac OS x86

* Test Mac OS x86

* Test Mac OS x86

* Update VERSION

* All builds again with Cython

* Update VERSION

* All builds again with Cython

* Update VERSION

* Mac only test

* Update VERSION

* Mac only Python 3.11 test

* Update VERSION

* Full Python 3.11 test

* Update version

* Cleanup for improved builds release

* Fix release job

* Release job debugging

* Release job debugging

* Release job debugging

* Release job debugging

* Release job debugging

* Release job debugging

* Remove invalid python 3.11

* Fix validation errors in Superset connection dialog (#46)

* Retry keep alive disconnects (#48)

* Append unixtime millis to the test db name when using Cloud (#50)

* Append unixtime millis to the test db name when using Cloud

* Fix create_db database name

* Update ignored test branches

Co-authored-by: Geoff Genz <[email protected]>

* Add Python code highlighting (#52)

* Remove rb (#54)

* Remove row_binary format

* Append unixtime millis to the test db name when using Cloud (#50)

* Append unixtime millis to the test db name when using Cloud

* Fix create_db database name

* Update ignored test branches

Co-authored-by: Geoff Genz <[email protected]>

* Cleanup for row_binary removal

Co-authored-by: Serge Klochkov <[email protected]>

* Valid params fix (#55)

* Fix various superset issues

* Fix lint

* Type fixes (#58)

* Fix UInt64 type bug, fix Superset big integers

* Fix typos

* Fix lint

* Release 0.3.2 (#60)

* Handle queries that are actually commands, simply and clean up tests

* Update version

* Fix test ordering

* Test fixes

* Fix command regex for 'SHOW CREATE' (#62)

* Remove exists and explain from commands

* SQLAlchemy Fixes (#63)

* Fix JSON insert for SQLAlchemy, update related tests

* Clean up JSON test configuration

* Remove UUID from JSON

* SQLAlchemy cleanup to provide better 1.4 compatibility

* Update changelog

* Update README

* Update README.md

* Update README.md

* Expand tests (#64)

* Add additional Python versions to tests

* Fix typo

* Tweaking workflow

* Tweaking workflow

* Tweaking workflow

* Tweaking workflow

* Tweaking workflow

* Tweaking workflow

* Tweaking workflow

* Remove arrow temporarily

* Finalize test matrix

* Fix classifier

* Version 0.3.5 build Python 3.11 wheels

* Fix query_context.updated_copy method, add first examples (#66)

* Chunked inserts (#67)

* Chunked and compressed inserts

* Fix chunk writes

* Fix lint

* One more chunk fix

* Avoid copying when building insert chunks

* Fix typo

* Fix compression bug

* Insert context (#70)

* Insert context checkpoint

* Pandas rework

* Handle internal error while streaming inserts

* Add query result in column format

* Reusable insert context work

* Improve InsertContext, add pandas tests

* Fix lint

* Update changelog

* Use CaseInsensitiveDict for sqla_type_map (#71)

* Use CaseInsensitiveDict for sqla_type_map

* Fix type

* Release 0 4 1 (#72)

* Numpy improvement checkpoint

* Numpy improvement checkpoint

* Numpy improvement checkpoint

* Numpy improvement checkpoint

* Numpy improvement checkpoint

* Add select connect_version to allowing checking from Superset SQLLab

* Fix some numpy big int and datetime issues

* Ensure little endian numpy types

* Clean up settings, minor fixes (#78)

* Various settings rework

* Fix arrow string setting

* Change Pandas NaN handling

* Allow setting http client HTTPAdapter, include VERSION in distribution (#79)

* Send all recognized transport headers regardless if recognized

* update Changelog to follow a common pattern (#81)

* Fix common settings bug (#82)

* Bug fixes (#83)

* Fix JSON inserts using ujson library (#85)

* File insert, server side bindings (#87)

* Add tool functions for uploading files, support dsn for client creation

* Add dsn test and get_client_setting method

* Fix dsn host

* Add support for server side parameter binding

* Fix dbapi issue, update test matrix

* Fix lint

* Fixes to align with doc

* Improve QueryContext usability

* Cleanup for contexts and raw_query method

* Additional tweaks to match updated documentation

* Update test matrix, removed unused docs directory

* Update year in LICENSE (#88)

* Streaming, C improvements, refactoring (#92)

* Spiking around streaming reads

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Add .c files

* Native streaming checkpoint

* Native streaming checkpoint

* Native streaming checkpoint

* Tiny cleanup

* Streaming updates and refactoring

* Fix Python 3.7 issues

* Fix versioning glitch

* Add fixed string optimizations

* Update changelog, uncomment C optimizations

* Make sure json allowed for tests.

* Make sure json allowed for tests (working version)

* Address some PR comments

* Noting that 0.5.0 is not yet released

* Compression updates, performance improvements (#95)

* Spiking around streaming reads

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Streaming reads checkpoint

* Add .c files

* Native streaming checkpoint

* Native streaming checkpoint

* Native streaming checkpoint

* Tiny cleanup

* Streaming updates and refactoring

* Fix Python 3.7 issues

* Fix versioning glitch

* Add fixed string optimizations

* Update changelog, uncomment C optimizations

* Make sure json allowed for tests.

* Make sure json allowed for tests (working version)

* Address some PR comments

* Remove requests layer

* Compression updates (in progress)

* Checkpoint for urllib migration

* Clean up TLS stuff

* Fix settings issue with SQLAlchemy connections, compression updates

* Fix certifi requirement

* Revert sqlalchemy version for tests

* Compression reorganization, QueryResult and Cython buffer cleanup

* Client construction cleanup, minor tweaks

* Clarify "certifi" package use

* Clean up compression config, add DSN test

* Fix lint

* Throw exception on unsupported compression type

* Fix source build issue

* Fix source build issue

* Still trying to fix builds

* Fix ping

* Fix handling of None database (#97)

* Fix QueryResult "with" statement context (#101)

* Fix QueryResult with context

* Add unit test for QueryResult with statement

* Prep for 0.5.3 patch release

* add a PR template (#103)

* add pr template

* Exclude github templates from tests

* Exclude github templates from tests take 2

Co-authored-by: Geoff Genz <[email protected]>

* v0.5.4 -- Numpy/Pandas improvements, stream refactoring (#105)

* Add C conversion for IPv4 native

* Tiny cleanup

* Add DateTime to c data_conv

* First work on specialized numpy columns

* numpy rework checkpoint

* numpy rework checkpoint

* date calculation checkpoint

* date calculation checkpoint

* Cleanup checkpoint

* query context cleanup

* numpy checkpoint

* Numpy read checkpoint

* context rework checkpoint

* format rework checkpoint

* format rework checkpoint

* progress toward pd/np reads

* progress toward pd/np reads

* stream cleanup checkpoint

* Add C optimization for UUID

* Minor cleanup, ready for tests

* Fix lint

* First work on optimizing None/NULL handling in Cython

* Tweak retries/connection resets

* Context cleanup checkpoint

* Fix lint

* Finalize for 0.5.4 release

* Fix lint

* Fix weird ORDER BY in test

* Tweak Cython UUID transform

* Add product_name, fix Numpy for Superset

* Downgrade Numpy Build for Python 3.7

* Clean up numpy build dependencies

* Fix numpy typo

* Don't build PyPy 3.7 binary wheels

* build debugging

* Tweak release/test actions

* Fix client_name refs

* Update test matrix, try to make cloud tests less flaky

* One more attempt at flaky cloud tests

* Cleanup changelog

* Fix numpy loc card (#110)

* Fix numpy lowcardinality exception

* Bump version

* Fix dataframe insert mutation (#113)

* Restore proxy support (#115)

* update perf_test, tweak pandas test

* Return empty df instead of list (#119)

* Add query_tz and column_tzs query arguments (#121)

* Add query_tz and column_tzs query arguments

* Move get_client docstring, add preliminary support for client_protocol_version

* Streaming fixes (#124)

* zstd problem debugging

* zstd problem debugging

* Stream error handling cleanup

* Optimize null strings, bug fixes (#125)

* zstd problem debugging

* zstd problem debugging

* Stream error handling cleanup

* Optimize nullable strings

* Respect use_none=False, add tests

* Fix stream error extraction

* Make stream error extraction a little tighter

* Close urllib3 connections on exit

* Close urllib3 connections on exit

* Better error message for invalid numpy DateTime64 types (#127)

* added column_oriented check to the named_results function (#129)

* SSH Tunnel example, support for client_protocol_version (#131)

* Better error message for invalid numpy DateTime64 types

* tweak test for Python 3.7

* Server host name (#134)

* Fix DSN database parsing

* Add server_host_name

* Fix ssh tunnel example

* Update issue templates

* Update issue templates

* Fix insert test

* Fix lint

* Panda nulls (#137)

* Handle pandas timezones

* use_na_values checkpoint

* use_na_values checkpoint

* use_na_values checkpoint

* use_na_values checkpoint

* Pandas nulls checkpoint

* Pandas nulls checkpoint

* Minor cleanup

* Fix bad pandas import

* Make optional import failures less scary

* init

* fix

* fix

* fix

* added support for version 19.x

* fixes playtest

* fixes Host header when server_host_name set

* fixes tests for 19.x server version
code refactoring

* revert back playtest

* removed noqa comments

---------

Co-authored-by: Geoff Genz <[email protected]>
Co-authored-by: guykohen <[email protected]>
Co-authored-by: guykoh <[email protected]>
Co-authored-by: Michael Harris <[email protected]>
Co-authored-by: Artem Popov <[email protected]>
Co-authored-by: Serge Klochkov <[email protected]>
Co-authored-by: Chun-Sheng, Li <[email protected]>
Co-authored-by: EugeneTorap <[email protected]>
Co-authored-by: Mikhail Shustov <[email protected]>
Co-authored-by: Ivan Blinkov <[email protected]>
Co-authored-by: John McCann Cunniff Jr <[email protected]>
Co-authored-by: Stas <[email protected]>
Co-authored-by: Aleksey Astafiev <[email protected]>
2023-03-06 03:34:06 -07:00

20 lines
686 B
Python

import clickhouse_connect
def main():
print(f'\nClickHouse Connect installed version: {clickhouse_connect.version()}')
client = clickhouse_connect.get_client(host='play.clickhouse.com',
username='play',
password='clickhouse',
port=443)
print(f'ClickHouse Play current version and timezone: {client.server_version} ({client.server_tz})')
result = client.query('SHOW DATABASES')
print('ClickHouse play Databases:')
for row in result.result_set:
print(f' {row[0]}')
client.close()
if __name__ == '__main__':
main()