In the following example, we will populate our table, including a field that stores images:
insert_string = """INSERT INTO tb_drive (id, wheel_angle, acc, image) VALUES (%s, %s, %s, %s)""" for data in dataset: # Split from dataset the image path, steering angle, and acceleration img_path, steering_angle, acc = data # Load image (png compressed) with open(img_path, 'rb') as f: content_file = f.read() # Insert into database session.execute(insert_string,(uuid.uuid1(), steering_angle, acc, content_file))