Skip to content

read_sql gives SQLAlchemy warning 'Could not instantiate type ...' #7380

Closed
@drastega

Description

@drastega

Related SO question: http://stackoverflow.com/questions/24096330/sawarning-could-not-instantiate-type-class-sqlalchemy-sql-sqltypes-integer

When I run the code below

import pandas as pd
import sqlalchemy

dbname = "sqlite:////Users/leda/home/Magnetic_stars/SQLite/Magnetic_stars.sqlite"
engine = sqlalchemy.create_engine(dbname)
res = pd.io.sql.read_sql("SELECT * FROM Resolved;", engine)

I get

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py:860: SAWarning: Could not instantiate type <class 'sqlalchemy.sql.sqltypes.INTEGER'> with reflected arguments [u'4']; using no arguments.
  coltype = self._resolve_type_affinity(type_)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py:860: SAWarning: Could not instantiate type <class 'sqlalchemy.sql.sqltypes.INTEGER'> with reflected arguments [u'2']; using no arguments.
  coltype = self._resolve_type_affinity(type_)
In [3]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.5.final.0
python-bits: 64
OS: Darwin
OS-release: 13.2.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: ru_RU.UTF-8

pandas: 0.14.0
nose: 1.3.1
Cython: 0.20.1
numpy: 1.8.1
scipy: 0.11.0
statsmodels: None
IPython: 0.13.2
sphinx: None
patsy: None
scikits.timeseries: None
dateutil: 2.2
pytz: 2014.4
bottleneck: None
tables: None
numexpr: 2.4
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
bq: None
apiclient: None
rpy2: 2.2.1
sqlalchemy: 0.9.4
pymysql: None
psycopg2: None

The schema of my SQLite table:

sqlite> .schema Resolved
CREATE TABLE `Resolved` (
`Name` TEXT NOT NULL COLLATE NOCASE,
`Count` INTEGER NOT NULL,
`Obs_Date` TEXT NOT NULL,
`Bessel_year` REAL,
`Filter` TEXT NOT NULL,
`Rho_mas` INTEGER,
`Sigma_rho` INTEGER,
`Theta` REAL,
`Sigma_theta` REAL,
`Dm` REAL,
`Sigma_dm` REAL,
`Orbit` INTEGER,
`Ref_star` TEXT COLLATE NOCASE,
`Comments` TEXT COLLATE NOCASE
);

P.S. Sorry if something is wrong. This is my first issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO SQLto_sql, read_sql, read_sql_query

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions