コード例 #1
0
ファイル: user.py プロジェクト: kookou/SBA_ML_chatbot
 def insert_many():
     service = UserService()
     Session = openSession()
     session = Session()
     df = service.hook()
     print(df.head())
     session.bulk_insert_mappings(UserDto, df.to_dict(orient="records"))
     session.commit()
     session.close()
コード例 #2
0
ファイル: user.py プロジェクト: kookou/SBA_ML_chatbot
            session['user'] = data[0]
        print(session)
        return data[0], 200

    @staticmethod
    def delete(userid):
        print('========== access delete 요청 받음 ==========')
        print(session)
        session.pop('user', None)
        # session.pop('user', None)
        # session.clear()
        return {'code': 0, 'message': 'SUCCESS'}, 200


# ------------ 실행 영역 --------------

if __name__ == '__main__':

    # 데이터 일괄 입력
    # df = pd.read_csv('./data/db/user.csv', sep=',', encoding='utf-8-sig') # 혜정
    df = pd.read_csv('./data/csv/important/db/user.csv',
                     sep=',',
                     encoding='utf-8-sig')  # 영돈
    df = df.replace(np.nan, 0, regex=True)

    Session = openSession()
    session = Session()
    session.bulk_insert_mappings(UserDto, df.to_dict(orient="records"))
    session.commit()
    session.close()