Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6203595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:56:37+00:00 2026-05-24T04:56:37+00:00

The python sqlite3 documentation gives this example for inserting parameters into an SQL query.

  • 0

The python sqlite3 documentation gives this example for inserting parameters into an SQL query.

for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
          ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),
          ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
         ]:
    c.execute('insert into stocks values (?,?,?,?,?)', t)

That’s fine for text and numbers. What if one of the fields is a binary BLOB, such as a JPEG image? How does one insert a binary file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:56:38+00:00Added an answer on May 24, 2026 at 4:56 am

    Insert binary data just as you would for any other type of field:

    contents = open(image_path, "rb").read()
    c.execute('insert into images values (?, ?)', (image_path, contents))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using sqlite3 in python 2.5. I've created a table that looks like this:
Using the sqlite3 standard library in python 2.6.4, the following query works fine on
I'm learning how to use sqlite3 with python. The example in the text book
I'm having a bit of trouble inserting into a sqlite3 database with pdo. You'll
In sqlite3 there is this table: create table t(d double) In python, the code
Whenever I try to create a table using python and sqlite3, it gives me
I'm attempting to use savepoints with the sqlite3 module built into python 2.6. Every
Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull
My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved
This is pretty strange (admitedly, this is my first attempt with python / sqlite),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.