Im getting a getting Error binding parameter 3 – probably unsupported type. How can I fix this table to the right format for sqlite?

huangapple go评论58阅读模式
英文:

Im getting a getting Error binding parameter 3 - probably unsupported type. How can I fix this table to the right format for sqlite?

问题

在SQLite中创建表格。我认为问题出在缩略图。有人能告诉我要用什么格式来存储jpg链接吗?

CREATE TABLE youtube_video (
id INTEGER PRIMARY KEY AUTOINCREMENT,
published_at TEXT,
title TEXT,
channel_id TEXT,
thumbnails TEXT, -- 缩略图可能需要另一种格式
channel_title TEXT,
view_count INTEGER,
like_count INTEGER,
dislike_count INTEGER,
favorite_count INTEGER,
duration TEXT,
video_id TEXT,
transcript TEXT
);


在PyCharm中的代码以向SQLite表格添加数据。cursor.execute(insert_query, ( 
                        cursor.execute(insert_query, (
                            snippet['publishedAt'],
                            snippet['title'],
                            snippet['channelId'],
                            snippet['thumbnails'],  -- 缩略图可能需要更改格式
                            snippet['channelTitle'],
                            statistics.get('viewCount', 0),
                            statistics.get('likeCount', 0),
                            statistics.get('dislikeCount', 0),
                            statistics.get('favoriteCount', 0),
                            content_details['duration'],
                            video_id,
                            transcript,
                        ))
                        ))

我遇到了一个错误,参数绑定错误,可能是不支持的数据类型。如何将这个表格调整为适合SQLite的正确格式?
英文:

table in sqlite. I think its the tumbnails. Can someone let me know what to use for a jpg link

CREATE TABLE youtube_video (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    published_at TEXT,
    title TEXT,
    channel_id TEXT,
    thumbnails TEXT,
    channel_title TEXT,
    view_count INTEGER,
    like_count INTEGER,
    dislike_count INTEGER,
    favorite_count INTEGER,
    duration TEXT,
    video_id TEXT,
    transcript TEXT
);

code in pycharm to add data to sqlite table. cursor.execute(insert_query, (

                            cursor.execute(insert_query, (
                                snippet['publishedAt'],
                                snippet['title'],
                                snippet['channelId'],
                                snippet['thumbnails'],
                                snippet['channelTitle'],
                                statistics.get('viewCount', 0),
                                statistics.get('likeCount', 0),
                                statistics.get('dislikeCount', 0),
                                statistics.get('favoriteCount', 0),
                                content_details['duration'],
                                video_id,
                                transcript,
                            ))
                            ))

Im getting a getting Error binding parameter 3 - probably unsupported type. How can I fix this table to the right format for sqlite?

答案1

得分: 0

像下面这样应该能解决问题:

    cursor.execute(insert_query, (
                                    str(snippet['publishedAt']),
                                    str(snippet['title']),
                                    str(snippet['channelId']),
                                    str(snippet['thumbnails']),
                                    str(snippet['channelTitle']),
                                    statistics.get('viewCount', 0),
                                    statistics.get('likeCount', 0),
                                    statistics.get('dislikeCount', 0),
                                    statistics.get('favoriteCount', 0),
                                    content_details['duration'],
                                    video_id,
                                    transcript,
                                ))
                                ))
英文:

Something like below should sort it out:

cursor.execute(insert_query, (
                                str(snippet['publishedAt']),
                                str(snippet['title']),
                                str(snippet['channelId']),
                                str(snippet['thumbnails']),
                                str(snippet['channelTitle']),
                                statistics.get('viewCount', 0),
                                statistics.get('likeCount', 0),
                                statistics.get('dislikeCount', 0),
                                statistics.get('favoriteCount', 0),
                                content_details['duration'],
                                video_id,
                                transcript,
                            ))
                            ))

huangapple
  • 本文由 发表于 2023年6月15日 02:08:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76476433.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定