sqlobject-discuss Mailing List for SQLObject (Page 35)
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: luis c. <lo....@gm...> - 2010-08-20 17:43:39
|
I have a pre-defined table in a SQL Server database that contains 4 columns + the primary key (integer). My class in Python is defined as: class HistoricalMatrix(SQLObject): class sqlmeta: fromDatabase = True table="HistoricalMatrix" ccy = StringCol(length = 4) dataDate = DateCol() handle = StringCol(length = 128) coeff = StringCol() the columns in the database are: id ccy data_date handle coeff The data_date column is specified as "data_date" in the database - is there a way I can specify this in the class definition? I came about using the mixed-case setup after some errors declaring the field as data_date in my Python class. |
From: Oleg B. <ph...@ph...> - 2010-08-14 19:39:00
|
Hello! On Sat, Aug 14, 2010 at 12:07:04PM -0700, Alex Morano wrote: > I have recently written converters for both a generic odbc driver and a > provider for Filemaker. > > I have had to edit the converters.py file in the core, which I'd rather not > do directly. > > Is there a way to register my own converters to be used when translating the > various fields (in this cvase datetime/date fields from Filemaker) inside my > SQLObject driver class rather than the basecode? The key word is "register" and yes, SQLObject allows that. You should spotted calls to registerConverter() all over converters.py. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Alex M. <am...@gm...> - 2010-08-14 19:07:17
|
Hello, I have recently written converters for both a generic odbc driver and a provider for Filemaker. I have had to edit the converters.py file in the core, which I'd rather not do directly. Is there a way to register my own converters to be used when translating the various fields (in this cvase datetime/date fields from Filemaker) inside my SQLObject driver class rather than the basecode? Thanks. |
From: Oleg B. <ph...@ph...> - 2010-08-11 16:24:21
|
On Wed, Aug 11, 2010 at 05:41:19PM +0200, Daniel Fetchinson wrote: > > I'm pleased to announce version 0.13.0, the first stable release of branch > > 0.13 of SQLObject. > > Thanks a lot Oleg! > I've tested my app and everything works with the new release. Thank you for the report! Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Daniel F. <fet...@go...> - 2010-08-11 15:41:26
|
> I'm pleased to announce version 0.13.0, the first stable release of branch > 0.13 of SQLObject. Thanks a lot Oleg! I've tested my app and everything works with the new release. Cheers, Daniel |
From: Oleg B. <ph...@ph...> - 2010-08-11 15:07:38
|
On Wed, Aug 11, 2010 at 06:58:40PM +0400, Oleg Broytman wrote: > I'm pleased to announce version 0.13.0 With this release I declare branch 0.11 obsolete and unmaintained. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-08-11 14:58:51
|
Hello! I'm pleased to announce version 0.13.0, the first stable release of branch 0.13 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.13.0 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.12 --------------- Features & Interface -------------------- * SQLObject instances that don't have a per-instance connection can be pickled and unpickled. * Validators became stricter: StringCol and UnicodeCol now accept only str, unicode or an instance of a class that implements __unicode__ (but not __str__ because every object has a __str__ method); BoolCol accepts only bool or int or an instance of a class that implements __nonzero__; IntCol accepts int, long or an instance of a class that implements __int__ or __long__; FloatCol accepts float, int, long or an instance of a class that implements __float__, __int__ or __long__. * Added a connection class for rdbhost.com (commercial Postgres-over-Web service). Small Features -------------- * Added TimedeltaCol; currently it's only implemented on PostgreSQL as an INTERVAL type. * Do not pollute the base sqlmeta class to allow Style to set idName. In the case of inherited idName inherited value takes precedence; to allow Style to set idName reset inherited idName to None. * Better handling of circular dependencies in sqlobject-admin - do not include the class in the list of other classes. * Renamed db_encoding to dbEncoding in UnicodeStringValidator. * A new parameter 'sslmode' was added to PostgresConnection. * Removed SQLValidator - its attemptConvert was never called because in FormEncode it's named attempt_convert. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-08-10 21:06:12
|
On Tue, Aug 10, 2010 at 04:15:38PM -0400, luis cota wrote: > Correct - ID is referring to the primary key in the table. If I insert a > data point(date, id, value), it is possible that I will update this point at > a later date. I can manually check in code for existence of the date, id > pair, though I was wondering if there was another way to do this, or if > there was already a way to impose such a constraint. Then create an index. > On Tue, Aug 10, 2010 at 2:37 PM, Oleg Broytman <ph...@ph...> wrote: > > > On Tue, Aug 10, 2010 at 02:16:26PM -0400, luis cota wrote: > > > How can I ensure that there exists only one value for a given Date, ID > > pair? > > > > In general, by creating a unique index on (date, id) pairs; you can > > create the index directly in SQL or in SQLObject. > > But in this particular case... you say ID - do you mean the primary key > > for the table? Well, it's itself a unique key, you don't need to make > > (date, id) pairs more unique. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: luis c. <lo....@gm...> - 2010-08-10 20:15:48
|
Correct - ID is referring to the primary key in the table. If I insert a data point(date, id, value), it is possible that I will update this point at a later date. I can manually check in code for existence of the date, id pair, though I was wondering if there was another way to do this, or if there was already a way to impose such a constraint. - Luis On Tue, Aug 10, 2010 at 2:37 PM, Oleg Broytman <ph...@ph...> wrote: > On Tue, Aug 10, 2010 at 02:16:26PM -0400, luis cota wrote: > > How can I ensure that there exists only one value for a given Date, ID > pair? > > In general, by creating a unique index on (date, id) pairs; you can > create the index directly in SQL or in SQLObject. > But in this particular case... you say ID - do you mean the primary key > for the table? Well, it's itself a unique key, you don't need to make > (date, id) pairs more unique. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Oleg B. <ph...@ph...> - 2010-08-10 18:37:58
|
On Tue, Aug 10, 2010 at 02:16:26PM -0400, luis cota wrote: > How can I ensure that there exists only one value for a given Date, ID pair? In general, by creating a unique index on (date, id) pairs; you can create the index directly in SQL or in SQLObject. But in this particular case... you say ID - do you mean the primary key for the table? Well, it's itself a unique key, you don't need to make (date, id) pairs more unique. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: luis c. <lo....@gm...> - 2010-08-10 18:16:28
|
How can I ensure that there exists only one value for a given Date, ID pair? - Luis |
From: Imri G. <lor...@gm...> - 2010-08-10 15:32:18
|
Heya Top of my head: Try also setting length = 90 or some lower number (perhaps start with 80). cheers, Imri On Tue, Aug 10, 2010 at 6:29 PM, luis cota <lo....@gm...> wrote: > Keeps throwing an error in MS SQL Server that this column type is not > capable of being made a key ... is it possible to make this a unique field > in SQL Server? My code is simple: > > class myClass(SQLObject): > fld_name = StringCol(alternateID=True, unique=True) > > Please help. > > - Luis > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: luis c. <lo....@gm...> - 2010-08-10 15:29:13
|
Keeps throwing an error in MS SQL Server that this column type is not capable of being made a key ... is it possible to make this a unique field in SQL Server? My code is simple: class myClass(SQLObject): fld_name = StringCol(alternateID=True, unique=True) Please help. - Luis |
From: Oleg B. <ph...@ph...> - 2010-08-07 15:05:19
|
On Fri, Aug 06, 2010 at 07:57:32PM -0700, Dominic LoBue wrote: > Hello, > > Is it possible to create a "virtual" column in SQLObject? Something like this: http://sqlobject.org/FAQ.html#composite-compound-attributes http://sqlobject.org/SQLObject.html#adding-magic-attributes-properties ? But you have to repeat your expression in WHERE clause. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-08-07 08:23:55
|
Hi Try (a simplified example): Select((agtAgent.q.name, agtAgent.q.level + agtAgent.q.quality), where = agtAgent.q.reqStanding > 5) I didn't try this specific query, but I tried one similar to it on my own db. Cheers, Imri On Sat, Aug 7, 2010 at 5:57 AM, Dominic LoBue <dom...@gm...>wrote: > Hello, > > Is it possible to create a "virtual" column in SQLObject? > > To give you an example of what I mean by a virtual column, given a > table named "agtAgent" with a StringCol() named "name", and two > IntCol()'s named "level" and "quality", consider this SQL statement: > select name, level, quality, (((level -1)*2) + (quality/20)) as > reqStanding from agtAgent where reqStanding > %i > > Is it possible to do something like this in SQLObject without having > to drop down to writing the sql queries manually? > > -- > Dominic LoBue > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Petr J. <pet...@tp...> - 2010-08-07 07:28:53
|
On 7 August 2010 04:57, Dominic LoBue <dom...@gm...> wrote: > Hello, > > Is it possible to create a "virtual" column in SQLObject? > > To give you an example of what I mean by a virtual column, given a > table named "agtAgent" with a StringCol() named "name", and two > IntCol()'s named "level" and "quality", consider this SQL statement: > select name, level, quality, (((level -1)*2) + (quality/20)) as > reqStanding from agtAgent where reqStanding > %i > > Is it possible to do something like this in SQLObject without having > to drop down to writing the sql queries manually? > > Hi, check the Using sqlmeta<http://www.sqlobject.org/SQLObject.html#using-sqlmeta>in the main SQLObject documentation (untested) class AgtAgent(SQLObject): class sqlmeta: fromDatabase = True columnList = True def _get_reqStanding(self): return(self.level-1)*2 + (self.quality/20) HTH Petr Jakes |
From: Dominic L. <dom...@gm...> - 2010-08-07 02:57:39
|
Hello, Is it possible to create a "virtual" column in SQLObject? To give you an example of what I mean by a virtual column, given a table named "agtAgent" with a StringCol() named "name", and two IntCol()'s named "level" and "quality", consider this SQL statement: select name, level, quality, (((level -1)*2) + (quality/20)) as reqStanding from agtAgent where reqStanding > %i Is it possible to do something like this in SQLObject without having to drop down to writing the sql queries manually? -- Dominic LoBue |
From: Dominic L. <dom...@gm...> - 2010-08-04 14:11:18
|
On Wed, Aug 4, 2010 at 4:18 AM, Oleg Broytman <ph...@ph...> wrote: > On Wed, Aug 04, 2010 at 03:50:53AM -0700, Dominic LoBue wrote: >> CREATE TABLE "chrFactions" ( > [skip] >> PRIMARY KEY ("factionID") >> ) >> >> >> And here's my definition: >> class chrFactions(SQLObject): >> class sqlmeta: >> style = MixedCaseStyle(longID=True) >> idName = 'factionID' >> fromDatabase = True >> >> However SQLObject clearly thinks there's a PRIMARY column for some reason: > > SQLObject's fromDatabase machinery is quite primitive and doesn't > support all of the backend features. In this case it sees the line > >> PRIMARY KEY ("factionID") > > and decides it is a column. To work around the problem add the following > parameter to SQLiteConnection constructor: use_table_info=True; if you use > DB URIs add '&use_table_info=1'. This switches SQLiteConnection to a > different, more clever parser. In the future I'm going to make that the > default; the switch is at the top of my TODO. > > Oleg. > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > Oleg, That fixed it, thanks! -- Dominic LoBue |
From: Oleg B. <ph...@ph...> - 2010-08-04 11:18:22
|
On Wed, Aug 04, 2010 at 03:50:53AM -0700, Dominic LoBue wrote: > CREATE TABLE "chrFactions" ( [skip] > PRIMARY KEY ("factionID") > ) > > > And here's my definition: > class chrFactions(SQLObject): > class sqlmeta: > style = MixedCaseStyle(longID=True) > idName = 'factionID' > fromDatabase = True > > However SQLObject clearly thinks there's a PRIMARY column for some reason: SQLObject's fromDatabase machinery is quite primitive and doesn't support all of the backend features. In this case it sees the line > PRIMARY KEY ("factionID") and decides it is a column. To work around the problem add the following parameter to SQLiteConnection constructor: use_table_info=True; if you use DB URIs add '&use_table_info=1'. This switches SQLiteConnection to a different, more clever parser. In the future I'm going to make that the default; the switch is at the top of my TODO. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Dominic L. <dom...@gm...> - 2010-08-04 10:51:03
|
On Tue, Aug 3, 2010 at 10:06 AM, Oleg Broytman <ph...@ph...> wrote: > On Mon, Aug 02, 2010 at 10:24:18PM -0700, Dominic LoBue wrote: >> I am not quite sure what the problem is, but I have so far ruled out >> both the database and my code. > > I am not so sure... > >> When I use the same code on the same >> database data in a mysql database, everything works fine. > > It could be that the SQL syntax you use is valid in MySQL but invalid in > SQLite. > >> 1/QueryR : SELECT FactionName, Description, solarSystemID, >> corporationID, militiaCorporationID, raceIDs, sizeFactor, >> stationCount, stationSystemCount, PRIMARY FROM chrFactions WHERE >> ((chrFactions.factionID) = (500001)) > >> sqlobject.dberrors.OperationalError: near "PRIMARY": syntax error > > What does it mean - SELECT *** PRIMARY FROM? It seems you've got a > column named PRIMARY... > > Oleg. > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > Oleg, I'm not writing my own SQL queries. All I'm doing in my test is calling the get method, the query is automatically generated. Also, keep in mind I used the following keywords when I called connectionForURI(): debug=True, debugOutput=True To answer your question, I do not know what it means or why it is trying to perform a select on 'PRIMARY'. There is no PRIMARY column, neither in my code nor in the database itself. I just double checked to be sure, and I was right, there's no PRIMARY column. Here's a create statement to recreate the table: CREATE TABLE "chrFactions" ( "factionID" int(11) NOT NULL, "factionName" varchar(100) default NULL, "description" varchar(1000) default NULL, "raceIDs" int(11) default NULL, "solarSystemID" int(11) default NULL, "corporationID" int(11) default NULL, "sizeFactor" double default NULL, "stationCount" smallint(6) default NULL, "stationSystemCount" smallint(6) default NULL, "militiaCorporationID" int(11) default NULL, PRIMARY KEY ("factionID") ) And here's my definition: class chrFactions(SQLObject): class sqlmeta: style = MixedCaseStyle(longID=True) idName = 'factionID' fromDatabase = True factionName = StringCol() description = StringCol() solarSystem = ForeignKey('mapSolarSystems', dbName='solarSystemID') corporation = ForeignKey('crpNPCCorporations', dbName='corporationID') militiaCorporation = ForeignKey('crpNPCCorporations', dbName='militiaCorporationID') corporations = MultipleJoin('crpNPCCorporations', joinColumn='factionID') solarSystems = MultipleJoin('mapSolarSystems', joinColumn='factionID') constellations = MultipleJoin('mapConstellations', joinColumn='factionID') regions = MultipleJoin('mapRegions', joinColumn='factionID') However SQLObject clearly thinks there's a PRIMARY column for some reason: >>> pprint(chrFactions.sqlmeta.columns) {'corporationID': <SOForeignKey corporationID connected to crpNPCCorporations>, 'description': <SOStringCol description>, 'factionName': <SOStringCol factionName>, 'militiaCorporationID': <SOForeignKey militiaCorporationID connected to crpNPCCorporations>, 'pRIMARY': <SOCol pRIMARY default=None>, 'raceIDs': <SOIntCol raceIDs default=None>, 'sizeFactor': <SOCol sizeFactor default=None>, 'solarSystemID': <SOForeignKey solarSystemID connected to mapSolarSystems>, 'stationCount': <SOIntCol stationCount default=None>, 'stationSystemCount': <SOIntCol stationSystemCount default=None>} Now why would it think that? -- Dominic LoBue |
From: Oleg B. <ph...@ph...> - 2010-08-03 17:07:09
|
On Mon, Aug 02, 2010 at 10:24:18PM -0700, Dominic LoBue wrote: > I am not quite sure what the problem is, but I have so far ruled out > both the database and my code. I am not so sure... > When I use the same code on the same > database data in a mysql database, everything works fine. It could be that the SQL syntax you use is valid in MySQL but invalid in SQLite. > 1/QueryR : SELECT FactionName, Description, solarSystemID, > corporationID, militiaCorporationID, raceIDs, sizeFactor, > stationCount, stationSystemCount, PRIMARY FROM chrFactions WHERE > ((chrFactions.factionID) = (500001)) > sqlobject.dberrors.OperationalError: near "PRIMARY": syntax error What does it mean - SELECT *** PRIMARY FROM? It seems you've got a column named PRIMARY... Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Dominic L. <dom...@gm...> - 2010-08-03 05:24:25
|
Hello, I am using SQLObject to create an object model for a legacy database which can be found here: http://zofu.no-ip.de/tyr101/ I am not quite sure what the problem is, but I have so far ruled out both the database and my code. When I use the same code on the same database data in a mysql database, everything works fine. I'll paste the stack trace along with all of SQLObject's debug output below. My code can be found: http://github.com/dlobue/evedbobject This code is being run on a gentoo linux machine with sqlite versions 2.8.16-r4 and 3.7.0 both installed. I am using python 2.6.4, and sqlobject 0.12.4. Here's the stack trace with all sqlobject debug output turned on: 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='crpNPCCorporations' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='crpNPCCorporations' 1/QueryOne-> ('CREATE TABLE "crpNPCCorporations" (\n "corporationID" int(11) NOT NULL,\n "size" char(1) default NULL,\n "extent" char(1) default NULL,\n "solarSystemID" int(11) default NULL,\n "investorID1" int(11) default NULL,\n "investorShares1" tinyint(4) default NULL,\n "investorID2" int(11) default NULL,\n "investorShares2" tinyint(4) default NULL,\n "investorID3" int(11) default NULL,\n "investorShares3" tinyint(4) default NULL,\n "investorID4" int(11) default NULL,\n "investorShares4" tinyint(4) default NULL,\n "friendID" int(11) default NULL,\n "enemyID" int(11) default NULL,\n "publicShares" bigint(20) default NULL,\n "initialPrice" int(11) default NULL,\n "minSecurity" double default NULL,\n "scattered" tinyint(1) default NULL,\n "fringe" tinyint(4) default NULL,\n "corridor" tinyint(4) default NULL,\n "hub" tinyint(4) default NULL,\n "border" tinyint(4) default NULL,\n "factionID" int(11) default NULL,\n "sizeFactor" double default NULL,\n "stationCount" smallint(6) default NULL,\n "stationSystemCount" smallint(6) default NULL,\n "description" varchar(4000) default NULL,\n PRIMARY KEY ("corporationID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='mapSolarSystems' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='mapSolarSystems' 1/QueryOne-> ('CREATE TABLE "mapSolarSystems" (\n "regionID" int(11) default NULL,\n "constellationID" int(11) default NULL,\n "solarSystemID" int(11) NOT NULL,\n "solarSystemName" varchar(100) default NULL,\n "x" double default NULL,\n "y" double default NULL,\n "z" double default NULL,\n "xMin" double default NULL,\n "xMax" double default NULL,\n "yMin" double default NULL,\n "yMax" double default NULL,\n "zMin" double default NULL,\n "zMax" double default NULL,\n "luminosity" double default NULL,\n "border" tinyint(1) default NULL,\n "fringe" tinyint(1) default NULL,\n "corridor" tinyint(1) default NULL,\n "hub" tinyint(1) default NULL,\n "international" tinyint(1) default NULL,\n "regional" tinyint(1) default NULL,\n "constellation" tinyint(1) default NULL,\n "security" double default NULL,\n "factionID" int(11) default NULL,\n "radius" double default NULL,\n "sunTypeID" smallint(6) default NULL,\n "securityClass" varchar(2) default NULL,\n PRIMARY KEY ("solarSystemID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='mapConstellations' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='mapConstellations' 1/QueryOne-> ('CREATE TABLE "mapConstellations" (\n "regionID" int(11) default NULL,\n "constellationID" int(11) NOT NULL,\n "constellationName" varchar(100) default NULL,\n "x" double default NULL,\n "y" double default NULL,\n "z" double default NULL,\n "xMin" double default NULL,\n "xMax" double default NULL,\n "yMin" double default NULL,\n "yMax" double default NULL,\n "zMin" double default NULL,\n "zMax" double default NULL,\n "factionID" int(11) default NULL,\n "radius" double default NULL,\n PRIMARY KEY ("constellationID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='mapRegions' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='mapRegions' 1/QueryOne-> ('CREATE TABLE "mapRegions" (\n "regionID" int(11) NOT NULL,\n "regionName" varchar(100) default NULL,\n "x" double default NULL,\n "y" double default NULL,\n "z" double default NULL,\n "xMin" double default NULL,\n "xMax" double default NULL,\n "yMin" double default NULL,\n "yMax" double default NULL,\n "zMin" double default NULL,\n "zMax" double default NULL,\n "factionID" int(11) default NULL,\n "radius" double default NULL,\n PRIMARY KEY ("regionID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='chrFactions' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='chrFactions' 1/QueryOne-> ('CREATE TABLE "chrFactions" (\n "factionID" int(11) NOT NULL,\n "factionName" varchar(100) default NULL,\n "description" varchar(1000) default NULL,\n "raceIDs" int(11) default NULL,\n "solarSystemID" int(11) default NULL,\n "corporationID" int(11) default NULL,\n "sizeFactor" double default NULL,\n "stationCount" smallint(6) default NULL,\n "stationSystemCount" smallint(6) default NULL,\n "militiaCorporationID" int(11) default NULL,\n PRIMARY KEY ("factionID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='staStations' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='staStations' 1/QueryOne-> ('CREATE TABLE "staStations" (\n "stationID" int(11) NOT NULL,\n "security" smallint(6) default NULL,\n "dockingCostPerVolume" double default NULL,\n "maxShipVolumeDockable" double default NULL,\n "officeRentalCost" int(11) default NULL,\n "operationID" tinyint(3) default NULL,\n "stationTypeID" smallint(6) default NULL,\n "corporationID" int(11) default NULL,\n "solarSystemID" int(11) default NULL,\n "constellationID" int(11) default NULL,\n "regionID" int(11) default NULL,\n "stationName" varchar(100) default NULL,\n "x" double default NULL,\n "y" double default NULL,\n "z" double default NULL,\n "reprocessingEfficiency" double default NULL,\n "reprocessingStationsTake" double default NULL,\n "reprocessingHangarFlag" tinyint(4) default NULL,\n PRIMARY KEY ("stationID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='staOperations' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='staOperations' 1/QueryOne-> ('CREATE TABLE "staOperations" (\n "activityID" tinyint(3) default NULL,\n "operationID" tinyint(3) NOT NULL,\n "operationName" varchar(100) default NULL,\n "description" varchar(1000) default NULL,\n "fringe" tinyint(4) default NULL,\n "corridor" tinyint(4) default NULL,\n "hub" tinyint(4) default NULL,\n "border" tinyint(4) default NULL,\n "ratio" tinyint(4) default NULL,\n "caldariStationTypeID" smallint(6) default NULL,\n "minmatarStationTypeID" smallint(6) default NULL,\n "amarrStationTypeID" smallint(6) default NULL,\n "gallenteStationTypeID" smallint(6) default NULL,\n "joveStationTypeID" smallint(6) default NULL,\n PRIMARY KEY ("operationID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT sql FROM sqlite_master WHERE type='table' AND name='staStationTypes' 1/QueryR : SELECT sql FROM sqlite_master WHERE type='table' AND name='staStationTypes' 1/QueryOne-> ('CREATE TABLE "staStationTypes" (\n "stationTypeID" smallint(6) NOT NULL,\n "dockingBayGraphicID" smallint(6) default NULL,\n "hangarGraphicID" smallint(6) default NULL,\n "dockEntryX" double default NULL,\n "dockEntryY" double default NULL,\n "dockEntryZ" double default NULL,\n "dockOrientationX" double default NULL,\n "dockOrientationY" double default NULL,\n "dockOrientationZ" double default NULL,\n "operationID" tinyint(3) default NULL,\n "officeSlots" tinyint(4) default NULL,\n "reprocessingEfficiency" double default NULL,\n "conquerable" tinyint(1) default NULL,\n PRIMARY KEY ("stationTypeID")\n)',) 1/COMMIT : auto 1/QueryOne: SELECT FactionName, Description, solarSystemID, corporationID, militiaCorporationID, raceIDs, sizeFactor, stationCount, stationSystemCount, PRIMARY FROM chrFactions WHERE ((chrFactions.factionID) = (500001)) 1/QueryR : SELECT FactionName, Description, solarSystemID, corporationID, militiaCorporationID, raceIDs, sizeFactor, stationCount, stationSystemCount, PRIMARY FROM chrFactions WHERE ((chrFactions.factionID) = (500001)) 1/COMMIT : auto Traceback (most recent call last): File "models.py", line 291, in <module> print(chrFactions.get(500001)) File "/usr/lib64/python2.6/site-packages/sqlobject/main.py", line 893, in get val._init(id, connection, selectResults) File "/usr/lib64/python2.6/site-packages/sqlobject/main.py", line 933, in _init selectResults = self._connection._SO_selectOne(self, dbNames) File "/usr/lib64/python2.6/site-packages/sqlobject/dbconnection.py", line 526, in _SO_selectOne return self._SO_selectOneAlt(so, columnNames, so.q.id==so.id) File "/usr/lib64/python2.6/site-packages/sqlobject/dbconnection.py", line 536, in _SO_selectOneAlt clause=condition))) File "/usr/lib64/python2.6/site-packages/sqlobject/dbconnection.py", line 392, in queryOne return self._runWithConnection(self._queryOne, s) File "/usr/lib64/python2.6/site-packages/sqlobject/dbconnection.py", line 262, in _runWithConnection val = meth(conn, *args) File "/usr/lib64/python2.6/site-packages/sqlobject/dbconnection.py", line 385, in _queryOne self._executeRetry(conn, c, s) File "/usr/lib64/python2.6/site-packages/sqlobject/sqlite/sqliteconnection.py", line 186, in _executeRetry raise OperationalError(ErrorMessage(e)) sqlobject.dberrors.OperationalError: near "PRIMARY": syntax error Any ideas? -- Dominic LoBue |
From: Oleg B. <ph...@ph...> - 2010-07-30 18:09:26
|
On Fri, Jul 30, 2010 at 07:47:12PM +0200, Imre Horvath wrote: > Is there a way to directly access postgres sequences from sqlobject? > Like select nextval() from sql? SQLObject doesn't prevent you from running SQL queries directly. You can even use SQLObject connection objects: result = connection.queryOne('SELECT nextval() FROM some_sequence') SQLObject uses the following schema to generate sequence names: table = Table.sqlmeta.table idName = Table.sqlmeta.idName sequenceName = Table.sqlmeta.idSequence or '%s_%s_seq' % (table, idName) Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imre H. <ble...@gm...> - 2010-07-30 17:47:24
|
Hi, Is there a way to directly access postgres sequences from sqlobject? Like select nextval() from sql? Thanks in advance: Imre Horvath |
From: Oleg B. <ph...@ph...> - 2010-07-30 17:42:44
|
Hello! I'm pleased to announce version 0.13.0b2, the second beta version of an upcoming release of branch 0.13 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.13.0b2dev-r4225 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.12.0b1 ------------------- * Removed SQLValidator - its attemptConvert was never called because in FormEncode it's named attempt_convert. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |