[(datetime.datetime(2013, 7, 29, 9, 2, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)]
От | |
---|---|
Тема | [(datetime.datetime(2013, 7, 29, 9, 2, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)] |
Дата | |
Msg-id | BA25E6A9A6B2B54EB96F4F12F3683E0319E594EE@dlrexmbx02.intra.dlr.de обсуждение исходный текст |
Ответы |
Re: [(datetime.datetime(2013, 7, 29, 9, 2,
tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)]
Re: [(datetime.datetime(2013, 7, 29, 9, 2, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)] |
Список | psycopg |
hi all, i want to create an timestamp with to_timestamp() and i get always an output like this [(datetime.datetime(2013, 7, 29, 9, 2, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)] here is the code -------------------------------------------%<----------------------------------------------------------------------------------------------------------->%------------------------------------------------------- D:\>C:\Python27_64bit\Scripts\ipython.exe Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 0.13 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [2]: import psycopg20 In [3]: conn = psycopg2.connect("port=5432 dbname='xxxDB' user='xxxUser' host='localhost' password='xxx'") In [4]: cur = conn.cursor() In [5]: sqlString=cur.mogrify("SELECT to_timestamp (%s, %s)", ...: ['130729.0902', ...: 'YYMMDD.HH24MI' ...: ]) In [6]: print(sqlString) SELECT to_timestamp ('130729.0902', 'YYMMDD.HH24MI') In [7]: cur.execute(sqlString) In [8]: rows = cur.fetchall() In [9]: print(rows) [(datetime.datetime(2013, 7, 29, 9, 2, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)),)] In [10]: print(psycopg2.__version__) 2.5.1 (dt dec pq3 ext) -------------------------------------------%<----------------------------------------------------------------------------------------------------------->%------------------------------------------------------- wihin psql the statement works well -------------------------------------------%<----------------------------------------------------------------------------------------------------------->%------------------------------------------------------- xxxDB=> SELECT to_timestamp ('130729.0902', 'YYMMDD.HH24MI'); to_timestamp ------------------------ 2013-07-29 09:02:00+00 (1 Zeile) -------------------------------------------%<----------------------------------------------------------------------------------------------------------->%------------------------------------------------------- I get the same output at windows, mac os and ubuntu, at different python versions (2.6, 2.7), different postgresql versions(8.4, 9.1, 9.2) and different psycopg versions (2.0.13, 2.5, 2.5.1) is this a problem of my code or a bug? thanks for your help christian
В списке psycopg по дате отправления: