0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00

Fix issue blocking clickhouse migrations on new installs (#7516)

Co-authored-by: James Greenhill <fuzionech@gmail.com>
This commit is contained in:
James Greenhill 2021-12-03 15:42:19 -08:00 committed by GitHub
parent b7df925186
commit 2fab8bfafa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View File

@ -155,7 +155,9 @@ jobs:
fetch-depth: 1
- name: Start stack with Docker Compose
run: docker-compose -f ee/docker-compose.ch.yml up -d ${{ matrix.foss && 'db' || 'db clickhouse zookeeper kafka' }}
run: |
docker-compose -f ee/docker-compose.ch.yml down
docker-compose -f ee/docker-compose.ch.yml up -d ${{ matrix.foss && 'db' || 'db clickhouse zookeeper kafka' }}
- name: Set up Python
uses: actions/setup-python@v2
@ -275,7 +277,9 @@ jobs:
cat multi_tenancy_settings.py >> deploy/posthog/settings.py
cat requirements.txt >> deploy/requirements.txt
- name: Start stack with Docker Compose
run: docker-compose -f deploy/ee/docker-compose.ch.yml up -d db clickhouse zookeeper kafka
run: |
docker-compose -f deploy/ee/docker-compose.ch.yml down
docker-compose -f deploy/ee/docker-compose.ch.yml up -d db clickhouse zookeeper kafka
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:

View File

@ -47,6 +47,21 @@ QUERY_TIMEOUT_THREAD = get_timer_thread("ee.clickhouse.client", SLOW_QUERY_THRES
_request_information: Optional[Dict] = None
def default_client():
"""
Return a bare bones client for use in places where we are only interested in general ClickHouse state
DO NOT USE THIS FOR QUERYING DATA
"""
return SyncClient(
host=CLICKHOUSE_HOST,
secure=CLICKHOUSE_SECURE,
user=CLICKHOUSE_USER,
password=CLICKHOUSE_PASSWORD,
ca_certs=CLICKHOUSE_CA,
verify=CLICKHOUSE_VERIFY,
)
def make_ch_pool(**overrides) -> ChPool:
kwargs = {
"host": CLICKHOUSE_HOST,

View File

@ -48,9 +48,10 @@ class ServiceVersionRequirement:
return self.version_string_to_semver(version)
def get_clickhouse_version(self):
from ee.clickhouse.client import sync_execute
from ee.clickhouse.client import default_client
rows = sync_execute("SELECT version()")
client = default_client()
rows = client.execute("SELECT version()")
version = rows[0][0]
return self.version_string_to_semver(version)