Menu

Dates returned as None

Help
2004-04-01
2012-09-19
  • Eduardo Elgueta

    Eduardo Elgueta - 2004-04-01

    Hi,

    I'm having this problem for any date (I double-checked dates are right), and table/database.

    I'm using MySQLdb 0.9.3b1, MySQL 4.017, and Python 2.3, and mx.DateTime 2.0.5 (MySQLdb compiled with no errors).

    TIA.

    Ed.

     
    • Greg Fortune

      Greg Fortune - 2004-04-02

      Is it possible that the date fields you are querying against are NULL?  You might list off your query and the relevent portion of your schema.

       
    • Eduardo Elgueta

      Eduardo Elgueta - 2004-04-02

      Greg,

      Thank for your answer.

      I'm super sure dates are not None. I've tested with MySQL date and datetime fields.

      -- data dump --
      # MySQL-Front Dump 2.5
      #
      # Host: localhost   Database: sgis
      # --------------------------------------------------------
      # Server version 4.0.17-max-nt

      #
      # Table structure for table 'po'
      #

      CREATE TABLE po (
        poid int(3) unsigned NOT NULL auto_increment,
        customer_id int(11) default '0',
        reference varchar(80) default '0',
        customer_po varchar(10) default NULL,
        date date default NULL, <--- I've tested renaming the field and with datetime data type
        ref2 varchar(10) default NULL,
        notes text,
        ref3 varchar(20) default NULL,
        ref3_desc varchar(80) default NULL,
        date_created datetime NOT NULL default '0000-00-00 00:00:00',
        user_created varchar(10) NOT NULL default '',
        date_updated datetime default NULL,
        user_updated varchar(10) NOT NULL default '',
        status int(11) default '0',
        del int(11) default '0',
        code varchar(7) default NULL,
        PRIMARY KEY  (poid)
      ) TYPE=MyISAM;

      #
      # Dumping data for table 'po'
      #

      INSERT INTO po VALUES("1", "1", "Reference", "12345", "2003-08-27", "2003", "", "crp123", "crp 123", "2003-08-27 15:26:30", "cga", "2003-08-28 18:13:32", "cga", "0", "0", "SYN0001");
      etc, etc.
      -- end --

       
      • Greg Fortune

        Greg Fortune - 2004-04-02

        How about the select query you are running that returns incorrect results?  I don't have mxDateTime installed, so my best bet is to take a look at the query.  I don't want to install it unless I have to.  And point out which exact fields in the query are returning incorrect results...

        btw, have you tried using the command line mysql client to run the query instead of MySQLdb to make sure that you're getting the correct data back through the standard client?

         
        • Eduardo Elgueta

          Eduardo Elgueta - 2004-04-07

          select po.poid, po.code, po.customer_id, customer.abreviation, po.ref1, po.date, po.date_created, po.date_updated, po.user_updated, po.notes, case po.status when 0 then "Draft" when 1 then "Active" when 2 then "Canceled" when 3 then "Finalized" else "?" end as status from po, customer where customer.customer_id = po.customer_id

          Thanks again.

           
          • Eduardo Elgueta

            Eduardo Elgueta - 2004-04-07

            I downloaded MySQLdb from CVS, built, installed, and everything works right.

             
            • Greg Fortune

              Greg Fortune - 2004-04-08

              Sorry I didn't get back to you, but I hadn't had time to get mxDateTime installed and tested against your problem.  Glad to hear you got it working.

               
    • Eduardo Elgueta

      Eduardo Elgueta - 2004-04-02

      This is the query:

      select po.poid, po.code, po.customer_id, customer.abreviation, po.ref1, po.date, po.date_created, po.date_updated, po.user_updated, po.notes, case po.status when 0 then "Draft" when 1 then "Active" when 2 then "Canceled" when 3 then "Finalized" else "?" end as status from po, customer where customer.customer_id = po.customer_id

      Thanks again.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.