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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:04:02+00:00 2026-06-05T09:04:02+00:00

Pulling some data from MongoDB and inserting it into a MySQL database, using Python

  • 0

Pulling some data from MongoDB and inserting it into a MySQL database, using Python and the Mysqldb library.

+-------------------+------------+------+-----+---------+----------------+
| Field             | Type       | Null | Key | Default | Extra          |
+-------------------+------------+------+-----+---------+----------------+
| id                | int(16)    | NO   | PRI | NULL    | auto_increment |
| subject           | tinytext   | NO   |     | NULL    |                |
| created_at        | datetime   | NO   |     | NULL    |                |
+-------------------+------------+------+-----+---------+----------------+

created_at  = "2012/06/08 11:47:40 -0700"
sql1 = ("INSERT INTO `items` (`description`, `created_at`) VALUES (%s, %s)", (description, created_at)
try:
    cursor.execute(*sql1)
except MySQLdb.Error, e:
    print "Error %s: %s" % (e.args[0], e.args[1])

For the first insert into the database I get a warning, however I don’t receive that warning for subsequent inserts.

conf/db_tools-import.py:53: Warning: Out of range value for column ‘created_at’ at row 1
cursor.execute(*sql1)

How can I resolve this?
Thanks.

  • 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-05T09:04:03+00:00Added an answer on June 5, 2026 at 9:04 am

    You are receiving an warning because you are inserting a long date into a date field. The date filed is “YYYY-MM-DD” (http://dev.mysql.com/doc/refman/5.1/en/datetime.html).

    I did my own test in Mysql, take a look:

    mysql> create table bigtable (created_at date);
    Query OK, 0 rows affected (0.07 sec)
    
    mysql> 
    
    Query OK, 1 row affected, 1 warning (0.00 sec)
    
    mysql> show warnings;
    +---------+------+-------------------------------------------------+
    | Level   | Code | Message                                         |
    +---------+------+-------------------------------------------------+
    | Warning | 1265 | Data truncated for column 'created_at' at row 1 |
    +---------+------+-------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> select * from bigtable;
    +------------+
    | created_at |
    +------------+
    | 2012-06-08 |
    +------------+
    1 row in set (0.00 sec)
    

    if you want to avoid the warning, just pass “YYYY-MM-DD” or change the column to datetime,

    Good luck

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

Sidebar

Related Questions

I am pulling some data from mysql database using PHP, now I would like
I'm using Entity Framework code first and pulling some data back from our database.
I'm pulling some data from a table using LINQ 2 SQL...one of the pieces
I'm pulling serialized data from a database along with an object type (where one
I am pulling some data from a mysql table via the following: $result =
I have my jquery mobile app pulling data from our mysql db using JSONP.
I am using django to pull some data from the MySQL server I have.
So, if I want to pull some data from my database (PHP, MySql), whether
I am pulling data from one table, called analyzedCopy, and using it to over-rite
I'm having some little issues pulling data from Twitter. Basically I am building a

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.