User 2032 | 9/17/2015, 9:54:03 AM
Please, please, please use real drivers for databases from DBAPI2 standard not ODBC.
When I'm selecting json or array data I get a string with the data and, most of the times it is corrupted beyond repair for larger tables or json objects. Right now an only reliable way to get data from postgress is via a pandas proxy:
import numpy as np from datetime import datetime import pandas as pd import graphlab as gl def sframes_from_postgres(query, conn, chunk_size=10000): dfs = pd.read_sql(query, conn, chunksize=chunk_size) for df in dfs: date_columns =  for t, c in zip(df.dtypes, df.columns): if np.issubdtype(t, np.datetime64): date_columns.append(c) df[date_columns] = df[date_columns].apply(np.datetime_as_string) yield gl.SFrame(df)
Another thing is that graphlab cannot parse np.datetime64[ns] and I have to waste CPU on explicit conversion to strings and then from strings (converting to regular datetime does not work).