sqlobject-discuss Mailing List for SQLObject (Page 366)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
(2) |
Mar
(43) |
Apr
(204) |
May
(208) |
Jun
(102) |
Jul
(113) |
Aug
(63) |
Sep
(88) |
Oct
(85) |
Nov
(95) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(93) |
Mar
(125) |
Apr
(89) |
May
(66) |
Jun
(65) |
Jul
(53) |
Aug
(65) |
Sep
(79) |
Oct
(60) |
Nov
(171) |
Dec
(176) |
2005 |
Jan
(264) |
Feb
(260) |
Mar
(145) |
Apr
(153) |
May
(192) |
Jun
(166) |
Jul
(265) |
Aug
(340) |
Sep
(300) |
Oct
(469) |
Nov
(316) |
Dec
(235) |
2006 |
Jan
(236) |
Feb
(156) |
Mar
(229) |
Apr
(221) |
May
(257) |
Jun
(161) |
Jul
(97) |
Aug
(169) |
Sep
(159) |
Oct
(400) |
Nov
(136) |
Dec
(134) |
2007 |
Jan
(152) |
Feb
(101) |
Mar
(115) |
Apr
(120) |
May
(129) |
Jun
(82) |
Jul
(118) |
Aug
(82) |
Sep
(30) |
Oct
(101) |
Nov
(137) |
Dec
(53) |
2008 |
Jan
(83) |
Feb
(139) |
Mar
(55) |
Apr
(69) |
May
(82) |
Jun
(31) |
Jul
(66) |
Aug
(30) |
Sep
(21) |
Oct
(37) |
Nov
(41) |
Dec
(65) |
2009 |
Jan
(69) |
Feb
(46) |
Mar
(22) |
Apr
(20) |
May
(39) |
Jun
(30) |
Jul
(36) |
Aug
(58) |
Sep
(38) |
Oct
(20) |
Nov
(10) |
Dec
(11) |
2010 |
Jan
(24) |
Feb
(63) |
Mar
(22) |
Apr
(72) |
May
(8) |
Jun
(13) |
Jul
(35) |
Aug
(23) |
Sep
(12) |
Oct
(26) |
Nov
(11) |
Dec
(30) |
2011 |
Jan
(15) |
Feb
(44) |
Mar
(36) |
Apr
(26) |
May
(27) |
Jun
(10) |
Jul
(28) |
Aug
(12) |
Sep
|
Oct
|
Nov
(17) |
Dec
(16) |
2012 |
Jan
(12) |
Feb
(31) |
Mar
(23) |
Apr
(14) |
May
(10) |
Jun
(26) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(6) |
2013 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(4) |
May
(13) |
Jun
(7) |
Jul
(5) |
Aug
(15) |
Sep
(25) |
Oct
(18) |
Nov
(7) |
Dec
(3) |
2014 |
Jan
(1) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(11) |
Nov
|
Dec
(62) |
2015 |
Jan
(8) |
Feb
(3) |
Mar
(15) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(19) |
2016 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
(7) |
Jul
(14) |
Aug
(13) |
Sep
(6) |
Oct
(2) |
Nov
(3) |
Dec
|
2017 |
Jan
(6) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
(44) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Oleg B. <ph...@ma...> - 2004-11-10 08:40:39
|
Hi! On Wed, Nov 10, 2004 at 01:50:55AM +0200, Ksenia Marasanova wrote: > Now another question: how to search RelatedJoin? I have a table > Address with many-to-many relation to it self. Address kan have > multiple addresses as parents, and can be a parent on it's own. I'd > like to find all children of given parent. How should I build this > query with SQLObject? The web is full of articles on hierarchical SQL. See, e.g.: http://www.onlamp.com/lpt/a/5007 http://www.oreillynet.com/lpt/a/2958 Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Luke O. <lu...@me...> - 2004-11-10 08:05:19
|
Quoting Ksenia Marasanova <kse...@gm...>: > > Now another question: how to search RelatedJoin? I have a table > Address with many-to-many relation to it self. Address kan have > multiple addresses as parents, and can be a parent on it's own. I'd > like to find all children of given parent. How should I build this > query with SQLObject? > As Ian says, if you're looking for _all_ the ancestors of a recursive structure like this, or an arbitrary distance in the tree, it's messy and there is probably bookkeeping info that will make it more manageable. If you just need direct children, RelatedJoin should do it for you, just have one for the parents and one for the children. Address --> [childID|parentID] <-- Address class Address(SQLObject): # col defs #... children = RelatedJoin('Address', joinColumn='parentID', otherColumn='childID') parents = RelatedJoin('Address', joinColumn ='childID', otherColumn='childID') Your question brings another one to mind, about additional criteria on the select used for joins (both RelatedJoin and MultipleJoin). Using your relationships: All children addresses with zipcode '98661' All parent addresses in the same city as the current record. I know I've mentioned this before, so this is more a reminder to myself - I keep finding reasons for this, but it's easy enough to work around, just a duplication of knowledge about what the joinColumns names are. It needs to take at least a query argument, and should probably take most of the select() arguments. Either an additional public method (joinMethodNameSelect perhaps) or an internal method of the join (which would need a better way to retrieve join objects - self._joinNames['joinMethodName'].select perhaps). If there's interest, I can take this on, since I've been using this idea so many times lately (on RelatedJoins) but working my way around by manually rebuilding the select statement. This way I could define: def childrenWithZipcode(self, zip): return self.childrenSelect(Address.q.zipcode == zip) def _get_parentsInSameCity(self): return self.parentsSelect(Address.q.city == self.city) RelatedJoins, and your self-referential example in particular, show the difficulty in this. If it were a MultipleJoin, say People to many addresses, the query would default to the query against the foreign table, no need to specify 'address.city', just 'city'. But in these examples, you'd either have to specify that clauseTables always apply to the joining side, or give a way to distinguish between the two sides of the join. And the selects for joins might actually have to be joins. :) Hmm. Easy enough to implement for MultipleJoins, messier syntax to decide on for RelatedJoins but still looks possible to me. Ian, any further plans for/against making Joins into fuller SelectResults-like objects? - Luke |
From: Ian B. <ia...@co...> - 2004-11-10 05:27:57
|
Ksenia Marasanova wrote: > I solved this: http://sourceforge.net/mailarchive/message.php?msg_id=9996700 > (don't have it in mijn mailbox for some reason) by explicitly > declaring a class for the third (many-to-many) table and adding > "cascade" attribute to the columns of this table. > > Now another question: how to search RelatedJoin? I have a table > Address with many-to-many relation to it self. Address kan have > multiple addresses as parents, and can be a parent on it's own. I'd > like to find all children of given parent. How should I build this > query with SQLObject? Blech; that's a real pain in SQL in general. There's whole books on it (literally). Hmm... I know I've seen several articles on it, but I'm missing them at the moment. Anyway, you have to use different tree representations if you want to do it with a single query. Maybe someone else has an article on this handy. Sometimes I've kept a table that contains all the ancestor relationships, maybe with a degree-of-separation column as well. You have to do a fair amount of bookkeeping to make it work (not at all normal), but it's relatively fast and easy to understand. There's some better algorithms that use different kinds of numbering. Using strings is also easy to understand, along the lines of a path. So '/a/b/c' means c is a child of '/a/b', and b is a child of '/a'. Lots of bookkeeping there as well. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Michel T. <mic...@ya...> - 2004-11-10 04:17:54
|
Hi! I faced the same problem, a parent has many children, I don't know well you case, my case isn't many-to-many, it is one to many, one parent to many children, each child can be a parent but cannot have more then one parent. My application is a forum, I ned a MultipleJoin and a ForeignKey o the same table but that time I couldn't have. I was creating the table throught SQLObject and I can't create a foreign key to a not existent table (the same table that doesn't exists yet). Maybe you can create the table manually, I don't try this way, I think this possibility just now :), you can create a ForeignKey yourself, I done this way: class Forum: parentID=IntCol(default=None) def _get_parent(self): return self.parentID and Forum.get(self.parentID) or None def _get_childs(self): return list(Forum.select(Forum.q.parentID==self.id)) def _create(self, id, **kw): kw['parentID']=kw.pop('parent').id This way you can work like that: Forum(parent=x)... Sorry my poor english, I hope I could help you... --- Ksenia Marasanova <kse...@gm...> escreveu: > Hi, > > I solved this: > http://sourceforge.net/mailarchive/message.php?msg_id=9996700 > (don't have it in mijn mailbox for some reason) by explicitly > declaring a class for the third (many-to-many) table and adding > "cascade" attribute to the columns of this table. > > Now another question: how to search RelatedJoin? I have a table > Address with many-to-many relation to it self. Address kan have > multiple addresses as parents, and can be a parent on it's own. I'd > like to find all children of given parent. How should I build this > query with SQLObject? > > > Thanks! > > -- > Ksenia > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > ===== -- Michel Thadeu Sabchuk Curitiba/PR _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ |
From: Ksenia M. <kse...@gm...> - 2004-11-09 23:51:05
|
Hi, I solved this: http://sourceforge.net/mailarchive/message.php?msg_id=9996700 (don't have it in mijn mailbox for some reason) by explicitly declaring a class for the third (many-to-many) table and adding "cascade" attribute to the columns of this table. Now another question: how to search RelatedJoin? I have a table Address with many-to-many relation to it self. Address kan have multiple addresses as parents, and can be a parent on it's own. I'd like to find all children of given parent. How should I build this query with SQLObject? Thanks! -- Ksenia |
From: Carlos R. <car...@gm...> - 2004-11-09 16:04:52
|
On Tue, 09 Nov 2004 14:59:57 +0100, Marc Saric <mar...@gm...> wrote: > Can anyone reproduce the failure (just cut & paste and uncomment the > __connection__-line and comment the _style-line). > > Is this a bug or am I doing something stupid here? > > Any answer would be appreciated. (this is an answer but I'm not sure if it will be appreciated...) I've *not* tested it. However, I was wondering if it couldn't be caused by some interaction with PostgreSQL, or the PostgreSQL driver, due either to a bug or to some limitation on naming (which differs a lot between DBs). What leads to another question, did you test it with another (different) database engine? It may help to reduce the problem space. -- Carlos Ribeiro Consultoria em Projetos blog: http://rascunhosrotos.blogspot.com blog: http://pythonnotes.blogspot.com mail: car...@gm... mail: car...@ya... |
From: Marc S. <mar...@gm...> - 2004-11-09 14:00:12
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, due to the fact, that I got no response to my previous mail "Problem with longID = True and sequences" from 2004-11-04 I did some more testing regarding this problem: I use SQLObject 0.6, PostgreSQL 7.4.2, Python 2.3.3, psycopg 1.1.14 on SuSE Linux 9.1. I have prepared the following little sample, which does or does not work depending on where you define longID = True: - --snip-- #! /usr/bin/env python from sqlobject import * __connection__ = PostgresConnection( ~ host='localhost', db='sqlobject_test', ~ user='YourUserName', passwd='', debug = 1) # FIXME: This does not work (but it should?) #__connection__.style = MixedCaseUnderscoreStyle(longID = True) class TestTable2(SQLObject): ~ # This does work, where's the difference? ~ _style = MixedCaseUnderscoreStyle(longID = True) ~ testEntry = StringCol() TestTable2.createTable() t2 = TestTable2( ~ testEntry = "bla" ~ ) # EOF - --snip-- According to the documentation, __connection__.style = MixedCaseUnderscoreStyle(longID = True) should also work (globaly) but it does not (longID is obviously ignored). Can anyone reproduce the failure (just cut & paste and uncomment the __connection__-line and comment the _style-line). Is this a bug or am I doing something stupid here? Any answer would be appreciated. - -- Bye, Marc Saric http://www.marcsaric.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFBkM1cvKxJUF29wRIRAmc0AJ9s23BfBvwUHSSC6QIUBery7fnHjgCdE38i rvarKhIcZEL7uMxhCPbQMPE= =MpiE -----END PGP SIGNATURE----- |
From: Ksenia M. <kse...@gm...> - 2004-11-09 00:30:26
|
Is it possible to set CASCADE option in the table, created by RelatedJoin column? I couldn't find it in the documentation or mailing list archive. Thanks, -- Ksenia |
From: Ksenia M. <kse...@gm...> - 2004-11-09 00:25:44
|
Thanks Ian and Oleg, It works now (I am using psycopg) -- Ksenia |
From: Oleg B. <ph...@ma...> - 2004-11-08 17:53:09
|
On Mon, Nov 08, 2004 at 10:49:41AM -0600, Ian Bicking wrote: > date = DateTime.convert(date) > > I actually don't know the right way to convert the date, you'll have to > look it up in the mxDateTime reference. date = DateTime.DateTimeFrom(date) Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Ian B. <ia...@co...> - 2004-11-08 16:52:39
|
Ksenia Marasanova wrote: > Hi, > > I have a class with DateTimeCol "date". I noticed, that the "date" > property of the instances is sometimes a DateTime object, and > sometimes a string: > > <Newsletter 1 date=<DateTime object for '2004-11-05 04:04:00.00' at > 212b10> sent=False subject='subject'> > > <Newsletter 1 date='2004/11/05 04:04' sent=False subject='subject'> > > Is there something I can do to get only DateTime object? Hmm... I assume that's happening in the driver (MySQLdb, psycopg, etc). You might try: def _get_date(self): date = self._SO_get_date() if isinstance(date, str): date = DateTime.convert(date) return date I actually don't know the right way to convert the date, you'll have to look it up in the mxDateTime reference. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Ksenia M. <kse...@gm...> - 2004-11-08 07:30:27
|
Hi, I have a class with DateTimeCol "date". I noticed, that the "date" property of the instances is sometimes a DateTime object, and sometimes a string: <Newsletter 1 =A0date=3D<DateTime object for '2004-11-05 04:04:00.00' at 212b10> sent=3DFalse subject=3D'subject'> <Newsletter 1 date=3D'2004/11/05 04:04' sent=3DFalse subject=3D'subject'> Is there something I can do to get only DateTime object? Thanks, --=20 Ksenia |
From: Ian B. <ia...@co...> - 2004-11-07 21:44:28
|
FYI... -------- Original Message -------- Subject: ANN: pymssql 0.6.0 Date: 7 Nov 2004 08:46:44 -0800 From: joo...@gm... (Joon-Cheol Park) To: com...@mo... pymssql 0.6.0 - Simple MSSQL python extension module pymssql supports "almost all" of the DB-API 2.0 URL: http://pymssql.sourceforge.net Download: https://sourceforge.net/project/showfiles.php?group_id=40059 Change: datetime field support. |
From: Oleg B. <ph...@ph...> - 2004-11-05 22:15:09
|
On Fri, Nov 05, 2004 at 03:38:48PM -0600, Ian Bicking wrote: > > ...but as I have said in the first message, both Postgres and MySQL > >use different quoting style. They use backslash to quote % and _: > > > > LIKE "%100\%%" > > > Oh, I missed that part. I just committed a change to sqlbuilder.py that > quotes in different ways depending on the database. Thank you! Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Ian B. <ia...@co...> - 2004-11-05 21:41:07
|
Oleg Broytmann wrote: > On Fri, Nov 05, 2004 at 03:06:18PM -0600, Ian Bicking wrote: > >>> Quoting? >> >>If you want to search for all fields that contain the text "100%" >>(literally, not treating % as a wildcard) you would search for > > > That's exactly what I want... > > >>field LIKE "%100%%%" > > > ...but as I have said in the first message, both Postgres and MySQL > use different quoting style. They use backslash to quote % and _: > > LIKE "%100\%%" > > I have consulted documentation for Postgres 7.3 and MySQL 4.0 before > asking about double percent. Oh, I missed that part. I just committed a change to sqlbuilder.py that quotes in different ways depending on the database. Then it really needs a unit test, and I'm not sure what the quoting rules are for all databases. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Oleg B. <ph...@ph...> - 2004-11-05 21:16:53
|
On Fri, Nov 05, 2004 at 03:06:18PM -0600, Ian Bicking wrote: > > Quoting? > > If you want to search for all fields that contain the text "100%" > (literally, not treating % as a wildcard) you would search for That's exactly what I want... > field LIKE "%100%%%" ...but as I have said in the first message, both Postgres and MySQL use different quoting style. They use backslash to quote % and _: LIKE "%100\%%" I have consulted documentation for Postgres 7.3 and MySQL 4.0 before asking about double percent. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Ian B. <ia...@co...> - 2004-11-05 21:08:52
|
Oleg Broytmann wrote: > On Fri, Nov 05, 2004 at 02:41:55PM -0600, Ian Bicking wrote: > >>Oleg Broytmann wrote: >> >>>Hello! Why double percent? >> >>CONTAINSSTRING hides the underlying wildcard implementation, quoting % >>as %%. > > > Quoting? If you want to search for all fields that contain the text "100%" (literally, not treating % as a wildcard) you would search for field LIKE "%100%%%" -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Oleg B. <ph...@ph...> - 2004-11-05 20:48:33
|
On Fri, Nov 05, 2004 at 02:41:55PM -0600, Ian Bicking wrote: > Oleg Broytmann wrote: > >Hello! Why double percent? > > CONTAINSSTRING hides the underlying wildcard implementation, quoting % > as %%. Quoting? > You can use sqlbuilder.LIKE for what you're doing. Thank you. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Ian B. <ia...@co...> - 2004-11-05 20:44:21
|
Oleg Broytmann wrote: > Hello! Why double percent? CONTAINSSTRING hides the underlying wildcard implementation, quoting % as %%. You can use sqlbuilder.LIKE for what you're doing. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Oleg B. <ph...@ph...> - 2004-11-05 16:20:10
|
Hello! Why double percent? I want to generate a query like SELECT * FROM atable WHERE afield LIKE '%pattern\%pattern%'; (I use SQLObject 0.5.3 with Postgres and MySQL, both use \% and \_ to quote these special characters.). CONTAINSSTRING(Atable.q.afiled, "pattern%pattern") produces SELECT * FROM atable WHERE afield LIKE '%pattern%%pattern%'; instead. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Josu O. <jo...@ub...> - 2004-11-05 08:49:38
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ian Bicking escribi=F3: | Josu Oyanguren wrote: | |> -----BEGIN PGP SIGNED MESSAGE----- |> Hash: SHA1 |> |> Hi all, |> |> i don't know if this is discussed. |> |> I'm trying to use SelectResults.sum to get the total for a column of |> floats. I think that it is trying to convert the result to an integer. | | | I think this is a bug. Oddly, it was put in there specifically; I'm | suspecting this is because SQLite is typeless, and you can almost forge= t | that except in the case of a computed value like SUM(), where PySQLite | doesn't get the metadata to figure out what the type is. I'm not sure | if there's a good way to support SQLite in this case. | I don't know the code enough to be sure, but i think it would be possible to do something like this: in dbconnection.py * DBAPI.accumulateSelect -> return the raw value and in main.py * SelectResults.count -> convert value to integer * SelectResults.sum -> convert value to the column type perhaps, an argument can be added to SelectResults.accumulate like this def accumulate(self, expression, converter=3DNone): ~ ... ~ if converter: ~ return converter(result) ~ else: ~ return result opening the door for other accumulates besides sum and count. (just thinking aloud) Josu. - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBiz5h5ju4HVxhuqQRAq1aAKC9q53gZERzRcZ/ZRoW35/DoL4+mwCgmmT1 3yqNTxFNi9Vl6XIQ41FYGvg=3D =3DgOPt -----END PGP SIGNATURE----- |
From: Marc S. <mar...@gm...> - 2004-11-04 20:49:10
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, I scanned the mailing-list archive but found no answer to my problem, so here it is: I try to access an externaly created PostgrSQL-database via SQLObject class ProgramOs(SQLObject): ~ _fromDatabase = True ~ [...] but get the following error: Traceback (most recent call last): [...] ~ File "/usr/lib/python2.3/site-packages/sqlobject/postgres/pgconnection.py", line 67, in _queryInsertID ~ c.execute("SELECT NEXTVAL('%s')" % sequenceName) psycopg.ProgrammingError: ERROR: relation "program_os_id_seq" does not exist SELECT NEXTVAL('program_os_id_seq') this is obviously because: 1. I try to use conn = connectionForURI('postgres://user@localhost/dbname') conn.style = MixedCaseUnderscoreStyle(longID = True) which (I hope) should give me londIDs with otherwise standard SQLObject-behaviour (if not please correct me). 2. "sequenceName" as seen in the traceback is a sequence named "program_os_id_seq" (but by standard convention this should be "<table>_<field>_seq", i.e. "program_os_program_os_id_seq"), so it is clear why it fails (there is no such sequence in the database, it would only be there if longID would be false and the id would simply be "id" not "program_os_id"). The question now is: Why? Is my conn.style-statement wrong? Is this a bug? Am I doing something stupid here? I would not want to change the primary key to "id" instead of "program_os_id", so this would be the last option. Thanks in advance. - -- Bye, Marc Saric -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFBioe9vKxJUF29wRIRAjVgAKCAPqTUa1VWQLQ3JwprzroxpoqtYwCfdyp3 07Z04fTZnZK39//ohs/vQu4= =jufH -----END PGP SIGNATURE----- |
From: Ian B. <ia...@co...> - 2004-11-04 17:50:55
|
Josu Oyanguren wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi all, > > i don't know if this is discussed. > > I'm trying to use SelectResults.sum to get the total for a column of > floats. I think that it is trying to convert the result to an integer. I think this is a bug. Oddly, it was put in there specifically; I'm suspecting this is because SQLite is typeless, and you can almost forget that except in the case of a computed value like SUM(), where PySQLite doesn't get the metadata to figure out what the type is. I'm not sure if there's a good way to support SQLite in this case. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
From: Josu O. <jo...@ub...> - 2004-11-04 16:57:35
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, i don't know if this is discussed. I'm trying to use SelectResults.sum to get the total for a column of floats. I think that it is trying to convert the result to an integer. Example: #------------- from sqlobject import * class Invoice(SQLObject): ~ provider = StringCol() ~ total = FloatCol() conn = SQLiteConnection(':memory:') Invoice._connection = conn Invoice.createTable() Invoice(provider='A', total=3.27) Invoice(provider='B', total=9.63) q = Invoice.select() print q.sum(Invoice.q.total) #---------------------- gets: - ------------------------- Traceback (most recent call last): ~ File "sql_sum_test.py", line 19, in ? ~ print q.sum(Invoice.q.total) ~ File "/usr/lib/python2.2/site-packages/sqlobject/main.py", line 1271, in sum ~ return self.accumulate(expression) ~ File "/usr/lib/python2.2/site-packages/sqlobject/main.py", line 1251, in accumulate ~ return conn.accumulateSelect(self,expression) ~ File "/usr/lib/python2.2/site-packages/sqlobject/dbconnection.py", line 248, in accumulateSelect ~ val = int(self.queryOne(q)[0]) ValueError: invalid literal for int(): 12.9 - ------------------------- (SQLObject version in 0.6) is this a bug or a feature? - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBil9B5ju4HVxhuqQRAjcTAKDXtSrCYLzR3/EeQ+iO7gMlTmyATgCfYpsM vShKUUQ9kocy22toP9D2pIc= =xHKA -----END PGP SIGNATURE----- |
From: Ian B. <ia...@co...> - 2004-11-03 17:40:26
|
Andrew Bennetts wrote: >>Aha I find a discussion reference to the joinMethod bug so I shall >>assume it will be fixed some time. > > > Yes, it's already fixed in SVN. > > I wonder if a 0.6.1 bugfix release would be worthwhile? I don't feel 100% sure that all the MultipleJoin bugs are worked out. I don't feel exactly clear what they all are. And the documentation that's related. But if that's all cleared up, then I can make another release. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |