Я работаю над ноутбуком Jupyter.
У меня есть следующий json файл:
{"num_songs": 1, "artist_id": "ARJIE2Y1187B994AB7", "artist_latitude": null, "artist_longitude": null, "artist_location": "", "artist_name": "Line Renaud", "song_id": "SOUPIRU12A6D4FA1E1", "title": "Der Kleine Dompfaff", "duration": 152.92036, "year": 0}
Я хочу загрузить его в таблицу с помощью оператора копирования.
Я создал свою таблицу следующим образом:
song_table_create = (""" CREATE TABLE songs (song_id varchar, title varchar, artist_id varchar, year int, duration float)""")
Вот мой оператор копирования:
test_statement = """copy songs (song_id, title, artist_id, year, duration) from '/home/workspace/data/song_data/A/B/C/TRABCRU128F423F449.json';"""
cur.execute(test_statement)
при запуске я получил следующую ошибку:
DataError: missing data for column "title"
CONTEXT: COPY songs, line 1: "{"num_songs": 1, "artist_id": "AR8IEZO1187B99055E", "artist_latitude": null, "artist_longitude": nul..."
Что не так?