Hi Oleg,

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Oleg Broytmann
> Sent: Friday, February 08, 2008 3:47 PM
> To: sqlobject-discuss@lists.sourceforge.net
> Subject: Re: [SQLObject] MS SQL pain for a newb
> 
> On Fri, Feb 08, 2008 at 03:07:33PM -0600, Mike Driscoll wrote:
> > I am a newb when it comes to SQLObject.
> 
>    Welcome!
> 
> > from sqlobject import *
> > 
> > # mssql://user:[EMAIL PROTECTED]:port/db
> > connection =
> > connectionForURI('mssql://user:[EMAIL PROTECTED]:port/db')
> > sqlhub.processConnection = connection
> > 
> > class tblAcctPrefs(SQLObject):    
> >     # these are the actual column names
> >     # is that a no-no?
> >     empID = StringCol()
> >     pref_name = StringCol()
> >     pref_value = StringCol()
> > 
> > tblAcctPrefs._connection.debug = True
> 
>    This could be achieved by
> connectionForURI('mssql://user:[EMAIL PROTECTED]:port/d
> b?debug=1')


That's good to know...Thanks for the tip!


> 
> > prefs = tblAcctPrefs.select()
> > list(prefs)
> > 
> > 1) Why does it change my column name from empID to emp_id?
> 
>    This how "styles" in SQLObject works. Default style changes 
> uppercase to lowercase and adds underscores.
> 
> > 2) Why does it insist on querying against an id column that
> I do not
> > specify?
> 
>    Every SQLObject's table must have a Primary Key id (not necessary 
> named "id").
> 
> > 3) How do I do this correctly?
> 
>    ALTER TABLE to add the id column. Or, if empID is the Primary Key, 
> use it as the id:
> 
> class tblAcctPrefs(SQLObject):
>     class sqlmeta:
>         idName = "emp_id"
>         idType = str
>     pref_name = StringCol()
>     pref_value = StringCol()
> 
> Oleg.

As I mentioned to Chris, since the tables I will be using have been
created by vendors and are outside of my control, I cannot alter the
tables as that would break their use for other programs that access them.
Thanks for the advice though. At least I know what to do if I create my
own databases.

Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to