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 8337509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:19:32+00:00 2026-06-09T04:19:32+00:00

I am trying to query an Microsoft SQL 2005 database, process the data and

  • 0

I am trying to query an Microsoft SQL 2005 database, process the data and write the keys to the data I updated to an sqllite3 database store locally on my machine.

The tools I’m using are python 2.7, pyodbc and sqllite3. I am on windows 7 and the driver I’ve tried connecting to my mssql db using the sql server and sql native client driver with pyodbc and both yield the same results.

The field I am having issues with is a uuid field that is binary(16) in mssql. When I query the data using pyodbc it is coming back to me in a bytearray().

This is the output I get when I run the following.

id = mycursor.fetchone()
print id

àO÷�eÅO‹1ÝWt‘E

repr(id)

bytearray(b’\xe0O\xf7\x1d\x9de\xc5O\x8b1\x0e\xddWt\x91E’)

When I go to insert that Id into an sqllite3 database I get the following.

s = sqlite3.connect('tmp.db')
cursor = s.cursor()
s.execute("create table recs(uuid blob)")
s.commit()
s.execute("insert into recs (uuid) values(?)", id)

1 s.execute(“insert into recs (uuid) values(?)”, id)

ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 16 supplied.

  • 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-06-09T04:19:33+00:00Added an answer on June 9, 2026 at 4:19 am

    The Python value needs to be a buffer object:

    >>> s.execute("insert into recs (uuid) values(?)", (buffer(id), ))
    <sqlite3.Cursor object at 0x011CD2E0>
    >>> r = s.execute("select * from recs").fetchone()
    >>> r
    (<read-write buffer ptr 0x011F9280, size 16 at 0x011F9260>,)
    >>> r[0]
    <read-write buffer ptr 0x011F9280, size 16 at 0x011F9260>
    >>> str(r[0])
    '\xe0O\xf7\x1d\x9de\xc5O\x8b1\x0e\xddWt\x91E'
    >>> str(r[0]) == id
    True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a Microsoft SQL Server 2005 query that counts a total
I am trying to write a Microsoft SQL Server query for retrieving the oldest
I am trying to reconstruct a database query I created for MySQL in Microsoft
I'm using microsoft SQL server management studio 2005 I'm trying to run a job
I am trying to write an query in Microsoft Query and it appears as
I'm trying to look for a value in my Microsoft SQL Server 2008 database
I'm trying to query using a XPath expression. My Microsoft SQL Server 2008 RC2
I have been trying to do a query using Microsoft SQL Server 2008 R2,
I am trying to query and parse Yahoo fantasy sports data and show results
I am trying to query some tables in my database using a simple dropdown

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.