为什么punksize参数在pandas.read_sql_query中不起作用?

时间:2019-07-01 18:31:13

标签: python sql-server pandas parameters

我想在pd.read_sql_query()中实现chunksize的使用,但是当我实现代码时,发生了意外的参数错误。不知道我是否缺少明显的东西。

def readFromSQL(SQLSentence, chunksize = None):

    try:
        engine = sa.create_engine(engine_definition)
        return_value = pd.read_sql_query(SQLSentence, engine,
                                         chunksize = chunksize)

    except sa.exc.DBAPIError:
        sys.exit("Error (DBAPIError)")

    return(return_value)

pdvs = readFromSQL("SELECT GOOGLE.* \
                           ,creation_time \
                        FROM [dbo].[DM_SOURCE_GOOGLE_DETAILS] AS GOOGLE\
                        JOIN \
                        ( \
                            SELECT place_id \
                                ,max(datetime) AS datetime \
                                , min(datetime) AS creation_time \
                            FROM [dbo].[DM_SOURCE_GOOGLE_DETAILS] \
                            GROUP BY place_id \
                        )AS date_updated \
                        ON GOOGLE.datetime = date_updated.datetime \
                            AND GOOGLE.place_id = date_updated.place_id", chunksize = 5)

但是我遇到以下错误readFromSQL()得到了意外的关键字参数'chunksize'

0 个答案:

没有答案