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

Fix fetch_table to be compatible across major pandas and sqlalchemy versions #159

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mendeleev/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pandas as pd
from sqlalchemy.dialects import sqlite
from sqlalchemy import text

from mendeleev import element
from mendeleev import __version__ as version
Expand Down Expand Up @@ -65,7 +66,9 @@ def fetch_table(table: str, **kwargs) -> pd.DataFrame:
)

engine = get_engine()
return pd.read_sql(table, engine, **kwargs)
query = f"SELECT * FROM {table}"
with engine.begin() as conn:
return pd.read_sql_query(sql=text(query), con=conn, **kwargs)


def fetch_electronegativities(scales: List[str] = None) -> pd.DataFrame:
Expand Down
Loading