Thread: [SQLObject] Make table belong to a schema (PostgreSQL) without setting the whole table name?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Igor M. <dow...@gm...> - 2005-12-30 06:01:15
|
When using PostgreSQL, I noticed you can do class sqlmeta: table =3D 'schemaname.tablename' However, this almost defeats the purpose of the tablename being automatically generated from the class name. Is there a way to specify a schema name, or maybe a prefix? How about some kind of namespace to use the schema? Just seems important, it's in ANSI after all. -Igor |
From: Oleg B. <ph...@ma...> - 2005-12-30 09:09:08
|
On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > When using PostgreSQL, I noticed you can do > > class sqlmeta: > table = 'schemaname.tablename' > > However, this almost defeats the purpose of the tablename being > automatically generated from the class name. Is there a way to specify a > schema name, or maybe a prefix? How about some kind of namespace to use the > schema? There is no currently. > Just seems important, it's in ANSI after all. Patches will be gladly accepted. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Igor M. <dow...@gm...> - 2005-12-30 14:33:23
|
I was thinking it could work something like this: directory model: file public.py: -classes defined here that are in "public" schema file otherschema.py: -classes defined here that are in "otherschema" schema Something like that on top of being able to set a schemaname in sqlmeta would be nice (or maybe just use schemaname =3D __name__ to implement the above)? Of course, in mysql using the schema notation is the equivalent fro= m using a different database, so what would be done about that? On 12/30/05, Oleg Broytmann <ph...@ma...> wrote: > > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > When using PostgreSQL, I noticed you can do > > > > class sqlmeta: > > table =3D 'schemaname.tablename' > > > > However, this almost defeats the purpose of the tablename being > > automatically generated from the class name. Is there a way to specify = a > > schema name, or maybe a prefix? How about some kind of namespace to use > the > > schema? > > There is no currently. > > > Just seems important, it's in ANSI after all. > > Patches will be gladly accepted. > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Cliff W. <cl...@de...> - 2005-12-30 21:18:52
|
Igor Murashkin wrote: > > Something like that on top of being able to set a schemaname in > sqlmeta would be nice (or maybe just use schemaname = __name__ to > implement the above)? Of course, in mysql using the schema notation is > the equivalent from using a different database, so what would be done > about that? > I agree that a standard way to specify the schema/namespace would be nice, but I think you have conflicted thinking when you mention ANSI and MySQL in the same argument ;-) I'd just make a fat note saying "MySQL doesn't support this concept" and maybe throw an exception for good measure. Regards, Cliff > On 12/30/05, *Oleg Broytmann* <ph...@ma... > <mailto:ph...@ma...>> wrote: > > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > When using PostgreSQL, I noticed you can do > > > > class sqlmeta: > > table = 'schemaname.tablename' > > > > However, this almost defeats the purpose of the tablename being > > automatically generated from the class name. Is there a way to > specify a > > schema name, or maybe a prefix? How about some kind of namespace > to use the > > schema? > > There is no currently. > > > Just seems important, it's in ANSI after all. > > Patches will be gladly accepted. > > Oleg. > -- > Oleg > Broytmann http://phd.pp.ru/ ph...@ph... > <mailto:ph...@ph...> > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click> > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > <mailto:sql...@li...> > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > <https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss> > > |
From: Igor M. <dow...@gm...> - 2005-12-31 05:16:08
|
Wouldn't that kind of defeat the point of abstracting? Shouldn't it emulate schema support somehow, such as through a table prefix, if a schemaname was specified instead of throwing an error? -Igor On 12/30/05, Cliff Wells <cl...@de...> wrote: > > Igor Murashkin wrote: > > > > Something like that on top of being able to set a schemaname in > > sqlmeta would be nice (or maybe just use schemaname =3D __name__ to > > implement the above)? Of course, in mysql using the schema notation is > > the equivalent from using a different database, so what would be done > > about that? > > > I agree that a standard way to specify the schema/namespace would be > nice, but I think you have conflicted thinking when you mention ANSI and > MySQL in the same argument ;-) I'd just make a fat note saying "MySQL > doesn't support this concept" and maybe throw an exception for good > measure. > > Regards, > Cliff > > > > On 12/30/05, *Oleg Broytmann* <ph...@ma... > > <mailto:ph...@ma...>> wrote: > > > > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > > When using PostgreSQL, I noticed you can do > > > > > > class sqlmeta: > > > table =3D 'schemaname.tablename' > > > > > > However, this almost defeats the purpose of the tablename being > > > automatically generated from the class name. Is there a way to > > specify a > > > schema name, or maybe a prefix? How about some kind of namespace > > to use the > > > schema? > > > > There is no currently. > > > > > Just seems important, it's in ANSI after all. > > > > Patches will be gladly accepted. > > > > Oleg. > > -- > > Oleg > > Broytmann http://phd.pp.ru/ ph...@ph... > > <mailto:ph...@ph...> > > Programmers don't die, they just GOSUB without RETURN. > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through > > log files > > for problems? Stop! Download the new AJAX search engine that make= s > > searching your log files as easy as surfing the web. DOWNLOAD > > SPLUNK! > > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > > <http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick> > > _______________________________________________ > > sqlobject-discuss mailing list > > sql...@li... > > <mailto:sql...@li...> > > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > > <https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss> > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Cliff W. <cl...@de...> - 2005-12-31 05:44:24
|
Igor Murashkin wrote: > Wouldn't that kind of defeat the point of abstracting? Shouldn't it > emulate schema support somehow, such as through a table prefix, if a > schemaname was specified instead of throwing an error? The point of abstraction is to allow you to easily write generic code that isn't database specific, not to deny you access to the features of a database (especially when those "features" are part of the SQL standard). Still, you have a valid point. In this particular case, it seems likely that the feature could be easily emulated for MySQL, and if this is true, then I'm for it. If it were to add a lot of messy or fragile code to SQLObject, then I'd be against it. What I'd rather not see, ultimately, is a lowest common denominator sort of abstraction which is aggravating for people who don't use a crippled database. Nor am I fond of pretending something works when it doesn't do anything (e.g. MySQL accepting the syntax for foreign keys but doing nothing with it) which in my mind violates the principle of "least surprise". That is the basis for my argument for throwing an exception: don't make the user think something is supported when it isn't (and no, I don't think you were arguing for that). As an aside, while it's been a while since I've used MySQL, I seem to recall that "databases" in MySQL were actually schema/namespaces, not actual databases (for instance, you can do joins across MySQL databases, something common to schema, not databases). Really it seems that MySQL suffers from bad terminology in this particular case. I'd say that MySQL supports schema but *not* multiple databases. Regards, Cliff > > -Igor > > On 12/30/05, *Cliff Wells* <cl...@de... > <mailto:cl...@de...>> wrote: > > Igor Murashkin wrote: > > > > Something like that on top of being able to set a schemaname in > > sqlmeta would be nice (or maybe just use schemaname = __name__ to > > implement the above)? Of course, in mysql using the schema > notation is > > the equivalent from using a different database, so what would be > done > > about that? > > > I agree that a standard way to specify the schema/namespace would be > nice, but I think you have conflicted thinking when you mention > ANSI and > MySQL in the same argument ;-) I'd just make a fat note saying > "MySQL > doesn't support this concept" and maybe throw an exception for > good measure. > > Regards, > Cliff > > > > On 12/30/05, *Oleg Broytmann* < ph...@ma... > <mailto:ph...@ma...> > > <mailto:ph...@ma... <mailto:ph...@ma...>>> wrote: > > > > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > > When using PostgreSQL, I noticed you can do > > > > > > class sqlmeta: > > > table = 'schemaname.tablename' > > > > > > However, this almost defeats the purpose of the tablename > being > > > automatically generated from the class name. Is there a way to > > specify a > > > schema name, or maybe a prefix? How about some kind of > namespace > > to use the > > > schema? > > > > There is no currently. > > > > > Just seems important, it's in ANSI after all. > > > > Patches will be gladly accepted. > > > > Oleg. > > -- > > Oleg > > > Broytmann http://phd.pp.ru/ ph...@ph... > <mailto:ph...@ph...> > > <mailto:ph...@ph... <mailto:ph...@ph...>> > > Programmers don't die, they just GOSUB without > RETURN. > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep > through > > log files > > for problems? Stop! Download the new AJAX search engine > that makes > > searching your log files as easy as surfing the web. DOWNLOAD > > SPLUNK! > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click> > > <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click>> > > _______________________________________________ > > sqlobject-discuss mailing list > > sql...@li... > <mailto:sql...@li...> > > <mailto:sql...@li... > <mailto:sql...@li...>> > > > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > <https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss> > > <https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss> > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click> > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > <mailto:sql...@li...> > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > <https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss> > > |
From: Jorge G. <go...@ie...> - 2005-12-31 11:40:20
|
Oleg Broytmann <ph...@ma...> writes: > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > When using PostgreSQL, I noticed you can do > > > > class sqlmeta: > > table = 'schemaname.tablename' > > > > However, this almost defeats the purpose of the tablename being > > automatically generated from the class name. Is there a way to specify a > > schema name, or maybe a prefix? How about some kind of namespace to use the > > schema? Besides that, it also causes problems when generating indexes because it puts the table name as a prefix and PostgreSQL doesn't accept "CREATE INDEX schemaname.tablename_name_of_index ..." as valid. -- Jorge Godoy <go...@ie...> "Quidquid latine dictum sit, altum sonatur." - Qualquer coisa dita em latim soa profundo. - Anything said in Latin sounds smart. |
Re: [SQLObject] Re: Make table belong to a schema (PostgreSQL) without setting the whole table name?
From: Igor M. <dow...@gm...> - 2006-01-05 07:30:59
|
Hello, I am interested in implementing something like sqlmeta.schemaName =3D '...'= or sqlmeta.tablePrefix =3D '....' I haven't touched any of the sqlobject code yet except for using sqlobject... so would anyone have any suggestions where I can start looking to do this? Should be relatively simple since schemaName *is* essentially a prefix except in the CREATE INDEX scenario. Also, would mysql schemaName be better implemented as a table prefix or as = a "database" prefix? (i.e. schemaName =3D 'foo' could append a "foo." to the table name, resulting in queries going to the "foo" database in mysql?). Thanks, Igor On 31 Dec 2005 09:33:38 -0200, Jorge Godoy <go...@ie...> wrote: > > Oleg Broytmann <ph...@ma...> writes: > > > On Fri, Dec 30, 2005 at 12:01:12AM -0600, Igor Murashkin wrote: > > > When using PostgreSQL, I noticed you can do > > > > > > class sqlmeta: > > > table =3D 'schemaname.tablename' > > > > > > However, this almost defeats the purpose of the tablename being > > > automatically generated from the class name. Is there a way to specif= y > a > > > schema name, or maybe a prefix? How about some kind of namespace to > use the > > > schema? > > Besides that, it also causes problems when generating indexes because it > puts > the table name as a prefix and PostgreSQL doesn't accept "CREATE INDEX > schemaname.tablename_name_of_index ..." as valid. > > > -- > Jorge Godoy <go...@ie...> > > "Quidquid latine dictum sit, altum sonatur." > - Qualquer coisa dita em latim soa profundo. > - Anything said in Latin sounds smart. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
Re: [SQLObject] Re: Make table belong to a schema (PostgreSQL) without setting the whole table name?
From: Oleg B. <ph...@ma...> - 2006-01-05 11:36:13
|
Hello! On Thu, Jan 05, 2006 at 01:30:57AM -0600, Igor Murashkin wrote: > I am interested in implementing something like sqlmeta.schemaName = '...' or > sqlmeta.tablePrefix = '....' Welcome! > I haven't touched any of the sqlobject code yet except for using > sqlobject... so would anyone have any suggestions where I can start looking > to do this? First learn to use development tools - diff and patch; use py.test to run tests. I can send you a dozen of scripts to show how I run these tests. Please always supply patches for tests and documentation. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
Re: [SQLObject] Re: Make table belong to a schema (PostgreSQL) without setting the whole table name?
From: Igor M. <dow...@gm...> - 2006-01-05 17:35:13
|
Great, I'll see if I can figure out how to use diff and patch, and in the meantime, can you send me those scrips? Thanks, Igor On 1/5/06, Oleg Broytmann <ph...@ma...> wrote: > > Hello! > > On Thu, Jan 05, 2006 at 01:30:57AM -0600, Igor Murashkin wrote: > > I am interested in implementing something like sqlmeta.schemaName =3D > '...' or > > sqlmeta.tablePrefix =3D '....' > > Welcome! > > > I haven't touched any of the sqlobject code yet except for using > > sqlobject... so would anyone have any suggestions where I can start > looking > > to do this? > > First learn to use development tools - diff and patch; use py.test to > run tests. I can send you a dozen of scripts to show how I run these > tests. > > Please always supply patches for tests and documentation. > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
Re: [SQLObject] Re: Make table belong to a schema (PostgreSQL) without setting the whole table name?
From: Oleg B. <ph...@ph...> - 2006-01-05 17:47:50
|
On Thu, Jan 05, 2006 at 11:35:07AM -0600, Igor Murashkin wrote: > meantime, can you send me those scrips? Sent directly to you. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |