Closed
Description
I'm importing data from an Excel spreadsheet and I'd like to generate a CREATE TABLE statement for PostgreSQL that matches the data I've imported from Excel.
Here's what I've got so far:
>>> import pandas as pd
>>> from sqlalchemy import create_engine
>>> import psycopg2
>>> basedata = pd.read_excel('mydata.xlsx')
>>> engine = create_engine('postgresql://myusername@localhost:5432/mydb')
>>> pd.io.sql.get_schema(basedata, 'basedata', con=engine)
Unfortunately the CREATE TABLE statement generated uses a column type of "DATETIME" that does not exist in PostgreSQL. I suspect that the engine object is being ignored somehow and the DDL I'm getting is for sqlite, not PostgreSQL. However, I can't get pandas to build on my Mac so that I can expand the tests to validate my assumption.