Re: Different results of running pure SQL query from Django and from PGAdmin

2018-09-12 Thread Pierre-Louis K.
Hello Bill, I managed to solve this in the end, the issue was that a cursor created in Django would enforce TIME_ZONE settings in the PostgreSQL session, where by default it is set to 'UTC' in my case. This means that all date manipulation was impacted, hence the unexpected results. The work ar

Re: Different results of running pure SQL query from Django and from PGAdmin

2018-09-11 Thread Bill-Torcaso-Oxfam
I'd be interested to see a printout of 'columns' and 'cursor.description'. One explanation would be that your for-loop is not actually accessing the data that you think it is, or that your query is not actually fetching the data that you think it is. No criticism of your query implied - just

Re: Different results of running pure SQL query from Django and from PGAdmin

2018-09-10 Thread pierre-louis . kabaradjian
Here is the body of the code that runs the query and fetch results: with connection.cursor() as cursor: sql = ( ... ) cursor.execute(sql, [params...]) columns = [col[0] for col in cursor.description] for row in cursor.fetchall(): print(row) The results from t

Re: Different results of running pure SQL query from Django and from PGAdmin

2018-09-08 Thread Jason
Hard to say what's happening without any code. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group

Different results of running pure SQL query from Django and from PGAdmin

2018-09-07 Thread Pierre-Louis K.
Hello django-users, I have been encountering a strange behaviour when trying to run SQL directly with a cursor. I am using Django 1.11 with porstgres 9.5.The query normally returns 7 rows with 2 columns. Symptoms: - When reading the queryset of a query I get wrong results -> I still have 7 row