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

DOC: read_sql_query docstring contraine wrong examples #58094

Closed
Tonow opened this issue Mar 31, 2024 · 0 comments · Fixed by #58095
Closed

DOC: read_sql_query docstring contraine wrong examples #58094

Tonow opened this issue Mar 31, 2024 · 0 comments · Fixed by #58095

Comments

@Tonow
Copy link
Contributor

Tonow commented Mar 31, 2024

The issuse is a line :

... data = pd.read_sql_table("data", conn) # doctest: +SKIP

The example is for the wrong function s/read_sql_table/read_sql_query

    Examples
    --------
    >>> from sqlalchemy import create_engine  # doctest: +SKIP
    >>> engine = create_engine("sqlite:///database.db")  # doctest: +SKIP
    >>> with engine.connect() as conn, conn.begin():  # doctest: +SKIP
    ...     data = pd.read_sql_table("data", conn)  # doctest: +SKIP

Should be replace by somthing like

    Examples
    --------
    >>> from sqlalchemy import create_engine  # doctest: +SKIP
    >>> engine = create_engine("sqlite:///database.db")  # doctest: +SKIP
    >>> sql_query = 'SELECT int_column FROM test_data  # doctest: +SKIP
    >>> with engine.connect() as conn, conn.begin():  # doctest: +SKIP
    ...     data = pd.read_sql_query(sql_query, conn)  # doctest: +SKIP

And this will modify https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql_query.html

Tonow added a commit to Tonow/pandas that referenced this issue Mar 31, 2024
Tonow added a commit to Tonow/pandas that referenced this issue Apr 2, 2024
mroeschke pushed a commit that referenced this issue Apr 2, 2024
DOC: read_sql_query docstring contraine wrong examples #58094
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this issue May 7, 2024
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

Successfully merging a pull request may close this issue.

1 participant