Menu

GROUP_CONCAT - returns array('c','1,2,3')

Help
monk.e.boy
2007-04-11
2012-09-19
  • monk.e.boy

    monk.e.boy - 2007-04-11

    Hi,

    Using GROUP_CONCAT in a MySQL query should return a string (a comma delimited string) but for some reason it is returning: array('c', '908,907')

    This is a bit weird. Then if I do:

    print row[0][0]

    I get '9', the first character of my comma delimited string. If I do:

    print str(row[0])

    I get: array('c', '908,907'). The only way of 'fixing' this is to add: "CONVERT(GROUP_CONCAT(urls.fk_link_to_page),char) as p" to my SQL which feels a bit wrong.

    Anyone know why this is happening and why it says 'array' when python doesn't even have arrays in it?

    Thanks,

    monk.e.boy

     
    • monk.e.boy

      monk.e.boy - 2007-04-16

      OK, many thanks for the help :-)

      monk.e.boy

       
    • Andy Dustman

      Andy Dustman - 2007-04-11

      Because you're using an old version and Python does have arrays in it?

       
    • monk.e.boy

      monk.e.boy - 2007-04-12

      I am using python 2.4.3 which does have arrays. Ooops. My mistake :-)

      How come this is returned as an array?

      cheers,

      monk.e.boy

       
      • Andy Dustman

        Andy Dustman - 2007-04-12

        You are using an old version of MySQLdb.

         

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.