Skip to content

HTTP authentication fails without username/password #387

@medgyes

Description

@medgyes

Describe the bug
Username,password is not mandatory for clickhouse. If they are not set then the current implementation sends a Basic Og== as the Authorization header and it fails.

To Reproduce
The code is not much, but one need a clickhouse instance without any user/password auth. I used the clickhouse/clickhouse-server:23.3.13.6-alpine docker image without the CLICKHOUSE_USER and CLICKHOUSE_PASSWORD env vars.

from sqlalchemy import create_engine, literal
from clickhouse_sqlalchemy import make_session

# have a clikchouse without password auth
url = 'clickhouse+http://localhost:8123'
http_engine = create_engine(url)
http_session = make_session(http_engine)

http_session.query(literal(1)).scalar() # this raises an error

Expected behavior
If the username is not set then do not send the Authorization header.

Versions

  • clickhouse-sqlalchemy 0.2.4 (reproducible with the current main as well)
  • python 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions