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评论96阅读模式
英文:

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

问题

  1. 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
);

  1. PyCharm中的代码以向SQLite表格添加数据。cursor.execute(insert_query, (
  1. cursor.execute(insert_query, (
  2. snippet['publishedAt'],
  3. snippet['title'],
  4. snippet['channelId'],
  5. snippet['thumbnails'], -- 缩略图可能需要更改格式
  6. snippet['channelTitle'],
  7. statistics.get('viewCount', 0),
  8. statistics.get('likeCount', 0),
  9. statistics.get('dislikeCount', 0),
  10. statistics.get('favoriteCount', 0),
  11. content_details['duration'],
  12. video_id,
  13. transcript,
  14. ))
  15. ))
  1. 我遇到了一个错误,参数绑定错误,可能是不支持的数据类型。如何将这个表格调整为适合SQLite的正确格式?
英文:

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

  1. CREATE TABLE youtube_video (
  2. id INTEGER PRIMARY KEY AUTOINCREMENT,
  3. published_at TEXT,
  4. title TEXT,
  5. channel_id TEXT,
  6. thumbnails TEXT,
  7. channel_title TEXT,
  8. view_count INTEGER,
  9. like_count INTEGER,
  10. dislike_count INTEGER,
  11. favorite_count INTEGER,
  12. duration TEXT,
  13. video_id TEXT,
  14. transcript TEXT
  15. );

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

  1. cursor.execute(insert_query, (
  2. snippet['publishedAt'],
  3. snippet['title'],
  4. snippet['channelId'],
  5. snippet['thumbnails'],
  6. snippet['channelTitle'],
  7. statistics.get('viewCount', 0),
  8. statistics.get('likeCount', 0),
  9. statistics.get('dislikeCount', 0),
  10. statistics.get('favoriteCount', 0),
  11. content_details['duration'],
  12. video_id,
  13. transcript,
  14. ))
  15. ))

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

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

  1. cursor.execute(insert_query, (
  2. str(snippet['publishedAt']),
  3. str(snippet['title']),
  4. str(snippet['channelId']),
  5. str(snippet['thumbnails']),
  6. str(snippet['channelTitle']),
  7. statistics.get('viewCount', 0),
  8. statistics.get('likeCount', 0),
  9. statistics.get('dislikeCount', 0),
  10. statistics.get('favoriteCount', 0),
  11. content_details['duration'],
  12. video_id,
  13. transcript,
  14. ))
  15. ))
英文:

Something like below should sort it out:

  1. cursor.execute(insert_query, (
  2. str(snippet['publishedAt']),
  3. str(snippet['title']),
  4. str(snippet['channelId']),
  5. str(snippet['thumbnails']),
  6. str(snippet['channelTitle']),
  7. statistics.get('viewCount', 0),
  8. statistics.get('likeCount', 0),
  9. statistics.get('dislikeCount', 0),
  10. statistics.get('favoriteCount', 0),
  11. content_details['duration'],
  12. video_id,
  13. transcript,
  14. ))
  15. ))

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:

确定