def main(): try: conn = database_connection.get_connection() result = select_example1_by_id(conn, 11) print(result) finally: conn.close()
def setUpClass(cls): cls.conn = database_connection.get_connection() # データ初期化 csv_to_db.load( cls.conn, example1= 'tests/data/test_example1/example1_test_select_example1_by_id.csv') cls.conn.commit()
def wrapper(*args, **kwargs): try: conn = database_connection.get_connection() conn.begin() load(conn, truncate=truncate, **targets) conn.commit() except Exception as e: conn.rollback() raise e finally: conn.close() return func(*args, **kwargs)
def main(): conn = database_connection.get_connection() conn.begin() try: init_db(conn, csv_dir="tests/data") conn.commit() except Exception as e: logger.error(e) conn.rollback() sys.exit(1) finally: conn.close() sys.exit(0)
def setUpClass(cls): cls.conn = database_connection.get_connection()