Re: [sqlalchemy] sqlite problem with datetime format YYYY-MM-DDTHH:mm:ss
Thanks a lot!! On Thursday, September 3, 2015 at 5:18:29 PM UTC+2, Simon King wrote: > > That's fine - the "regexp" argument is only used when interpreting the > data that comes back from sqlite - it doesn't depend on you actually > creating the table from SQLAlchemy. > > It does require that you have an in-python "definition" of the table > structure, which I assume you already have, unless you are simply > using SQLAlchemy to issue raw SQL to sqlite. Do you have any table > definitions in your Python code, or are you using reflection? > > If you are using reflection, you can override specific column > definitions as described at > > > http://docs.sqlalchemy.org/en/rel_1_0/core/reflection.html#overriding-reflected-columns > > > and > > > http://docs.sqlalchemy.org/en/rel_1_0/orm/extensions/declarative/table_config.html#using-reflection-with-declarative > > > Simon > > On Thu, Sep 3, 2015 at 3:54 PM, Massi> wrote: > > Hi Simone, > > > > thank you for your reply. Unfortunately I don't create the table so I > don't > > define the table, I only load it from the DB. I hope I intended your > > suggestion correctly. > > > > Thanks again. > > > > On Thursday, September 3, 2015 at 3:54:45 PM UTC+2, Simon King wrote: > >> > >> On Thu, Sep 3, 2015 at 1:05 PM, Massi wrote: > >> > Hi everyone, > >> > > >> > I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which > >> > contains > >> > some datetime columns. As the title says these column are given in > the > >> > format -MM-DDTHH:mm:ss (I did not create the table). When I > execute > >> > the > >> > query, it succeeds, but when I try to convert the rows to lists I get > >> > the > >> > following error: > >> > > >> > ValueError: Couldn't parse datetime string: u'1957-09-04T23:04:37' > >> > > >> > If I try to create a similar table via sqlalchemy and then to read > the > >> > data > >> > everything works fine. The data in this case is stored in the format > >> > -MM-DD HH:mm:ss. > >> > Any hint? > >> > > >> > Thanks in advance! > >> > > >> > >> You could try passing the regexp parameter to the DateTime column in > >> your table definition: > >> > >> > >> > http://docs.sqlalchemy.org/en/rel_1_0/dialects/sqlite.html#sqlalchemy.dialects.sqlite.DATETIME > > >> > >> Hope that helps, > >> > >> Simon > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sqlalchemy+...@googlegroups.com . > > To post to this group, send email to sqlal...@googlegroups.com > . > > Visit this group at http://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] sqlite problem with datetime format YYYY-MM-DDTHH:mm:ss
Hi Simone, thank you for your reply. Unfortunately I don't create the table so I don't define the table, I only load it from the DB. I hope I intended your suggestion correctly. Thanks again. On Thursday, September 3, 2015 at 3:54:45 PM UTC+2, Simon King wrote: > > On Thu, Sep 3, 2015 at 1:05 PM, Massi> wrote: > > Hi everyone, > > > > I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which > contains > > some datetime columns. As the title says these column are given in the > > format -MM-DDTHH:mm:ss (I did not create the table). When I execute > the > > query, it succeeds, but when I try to convert the rows to lists I get > the > > following error: > > > > ValueError: Couldn't parse datetime string: u'1957-09-04T23:04:37' > > > > If I try to create a similar table via sqlalchemy and then to read the > data > > everything works fine. The data in this case is stored in the format > > -MM-DD HH:mm:ss. > > Any hint? > > > > Thanks in advance! > > > > You could try passing the regexp parameter to the DateTime column in > your table definition: > > > http://docs.sqlalchemy.org/en/rel_1_0/dialects/sqlite.html#sqlalchemy.dialects.sqlite.DATETIME > > > Hope that helps, > > Simon > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] sqlite problem with datetime format YYYY-MM-DDTHH:mm:ss
On Thu, Sep 3, 2015 at 1:05 PM, Massiwrote: > Hi everyone, > > I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which contains > some datetime columns. As the title says these column are given in the > format -MM-DDTHH:mm:ss (I did not create the table). When I execute the > query, it succeeds, but when I try to convert the rows to lists I get the > following error: > > ValueError: Couldn't parse datetime string: u'1957-09-04T23:04:37' > > If I try to create a similar table via sqlalchemy and then to read the data > everything works fine. The data in this case is stored in the format > -MM-DD HH:mm:ss. > Any hint? > > Thanks in advance! > You could try passing the regexp parameter to the DateTime column in your table definition: http://docs.sqlalchemy.org/en/rel_1_0/dialects/sqlite.html#sqlalchemy.dialects.sqlite.DATETIME Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] sqlite problem with datetime format YYYY-MM-DDTHH:mm:ss
Hi everyone, I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which contains some datetime columns. As the title says these column are given in the format -MM-DDTHH:mm:ss (I did not create the table). When I execute the query, it succeeds, but when I try to convert the rows to lists I get the following error: ValueError: Couldn't parse datetime string: u'1957-09-04T23:04:37' If I try to create a similar table via sqlalchemy and then to read the data everything works fine. The data in this case is stored in the format -MM-DD HH:mm:ss. Any hint? Thanks in advance! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.