📜  psql 使用查询结果转换十进制 python numpy psycopg2 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:59.329000             🧑  作者: Mango

代码示例1
DEC2FLOAT = psycopg2.extensions.new_type(
    psycopg2.extensions.DECIMAL.values,
    'DEC2FLOAT',
    lambda value, curs: float(value) if value is not None else None)
psycopg2.extensions.register_type(DEC2FLOAT)