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

  • SEARCH
  • Home
  • 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 9020419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:00:43+00:00 2026-06-16T05:00:43+00:00

I am seeing the strangest behavior in a script of mine. I’m getting a

  • 0

I am seeing the strangest behavior in a script of mine. I’m getting a ValueError from dbapi2.py where it seems to be trying to do a conversion on a datetime.date object as if it were a datetime.datetime object:

  File "C:\Python27\Lib\sqlite3\dbapi2.py", line 66, in convert_timestamp
    datepart, timepart = val.split(" ")
  ValueError: need more than 1 value to unpack

I am not doing anything special, in fact I have several other scripts doing the exact same thing with slightly different tSql and no problems at all. Here’s the Class to build the Sql:

class TransactionQuery:

    def __init__(self, account_iter, date):
        self.account_iter = tuple(account_list)
        self.date = date
        placeholder = ("?" for item in self.account_list)
        placeholders = ', '.join(item for item in placeholder)
        self.query = """select * from transactions where account_cd in (%s) and 
                        effected_dt = ?""" % placeholders

    @property
    def params(self):
        return (self.account_list) + (self.date,)

The code that calls it:

with Sqlite() as curs:
    print mquery.query
    print mquery.params
    curs.execute(mquery.query, mquery.params)
    return curs.fetchall()

And the outputs from the print statements:

select * from transactions where account_cd in (?, ?, ?, ?) and effected_dt = ?
('713271', '71204', '713311', '713471', datetime.date(2012, 12, 17))

Any ideas why Sqlite would have trouble with a datetime.date object in this case?

  • 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-16T05:00:44+00:00Added an answer on June 16, 2026 at 5:00 am

    You’re missing the timepart:

    (datepart, timepart) = str( datetime.date(2012, 12, 17) ).split( ' ' )
    ## ValueError: need more than 1 value to unpack
    

    sqlite3 is hitting the convert_timestamp converter.

    Default Adapters and Converters documentation page for sqlite3 shows some examples. From what is known I can try and assume that effected_dt is a timestamp which expects a complete datetime.datetime string instead.

    So what you’d do is on of the following:

    • use datetime.datetime instead
    • register a new converter for the timestamp type that accepts dates (returning “2012-12-17 00:00:00” for example)
    • change your column type

    Hope this makes sense and helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm seeing some strange behavior in IE trying to call functions in another page
I'm seeing some strange behavior when trying to capture an instance of a C++
I'm seeing some strange behavior while trying to add a basic markup for a
I'm seeing strange behavior when scaling Delayed::Job workers on Heroku. I have a few
I'm using MVC3 .NET4.0 (VB), and I'm seeing some strange behavior on a simple
I'm implementing drag & drop from a ListBox, but I'm seeing some strange behaviour
I'm seeing a very strange error when trying to use ViewPagerIndicator (http://viewpagerindicator.com/). I've narrowed
Strange error that I'm seeing when trying to restore transactions: 06-29 10:04:30.765: I/BillingService(16135): checkResponseCode
Currently, I'm seeing a strange behavior in my .NET 2.0 WinForms application. Hosting a
I am trying to connect as a client over SSL and am seeing some

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.