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

INSERT INTO FROM INFILE times out #466

Open
billsbooth opened this issue Dec 11, 2024 · 1 comment
Open

INSERT INTO FROM INFILE times out #466

billsbooth opened this issue Dec 11, 2024 · 1 comment

Comments

@billsbooth
Copy link

Describe the bug
INFILE CSV insert hangs, and times out.

Running a Clickhouse in the docker container, I have copied the CSV file into the docker container, and running a Python script from the host computer that does an INFILE CSV insert.

I have verified that connection works (I can run other queries, and get results).

Insert query just hangs.

To Reproduce

def load_to_clickhouse(csv_filename, table_name='public.trades'):
    print("Loading into ClickHouse...")
    client = Client(
        host='localhost',
        port=CLICKHOUSE_PORT,
        user='default',
    )

    # Load data using local file method
    query = f"""
        INSERT INTO {table_name}
        FROM INFILE '{csv_filename}';
    """

    print(query)

    try:
        print(client.execute(query))
        print(f"Successfully loaded rows into ClickHouse")
    except Exception as e:
        print(f"Error loading data: {e}")
    finally:
        client.disconnect()

Expected behavior
CSV is imported via INFILE.

Versions

python3 --version
Python 3.13.1

SELECT version()
┌─version()──┐

  1. │ 24.10.2.80 │
    └────────────┘
@den-crane
Copy link

Use the other python driver https://github.com/ClickHouse/clickhouse-connect
It works over HTTP and thus is able to ingest CSV https://clickhouse.com/docs/en/integrations/python#file-inserts

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