sqlobject-discuss Mailing List for SQLObject (Page 20)
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
(1) |
Dec
(2) |
|
From: Glenn R. <gru...@ed...> - 2012-04-13 17:20:12
|
Everything was running fine last night. Came in this morning and my
test system is acting weird. I'm doing my best to find the answer but
in the meantime, if someone knows what this is, I could use a bit of help.
Thanks,
Glenn
Today:
>>> from sqlobject import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sqlobject.py", line 8, in <module>
conn = connectionForURI(connection_string)
NameError: name 'connectionForURI' is not defined
System Setup:
Python 2.7.2 on Windows XP
Path = c:\python27;c:\python27\Scripts;C:\Python27\Lib\site-packages
Installed pymssql
Installed SQLObject 1.3.0
>easy_install -U SQLObject
Searching for SQLObject
Reading http://pypi.python.org/simple/SQLObject/
Reading http://sqlobject.org
Reading http://sqlobject.org/
Reading http://sqlobject.org/devel/
Best match: SQLObject 1.3.0
Downloading
http://pypi.python.org/packages/2.7/S/SQLObject/SQLObject-1.3.0-py2.7.egg#md5=42e649b0c1
08b75a1bec8f22e84270fa
Processing SQLObject-1.3.0-py2.7.egg
creating c:\python27\lib\site-packages\SQLObject-1.3.0-py2.7.egg
Extracting SQLObject-1.3.0-py2.7.egg to c:\python27\lib\site-packages
Adding SQLObject 1.3.0 to easy-install.pth file
Installing sqlobject-admin script to c:\python27\Scripts
Installing sqlobject-convertOldURI script to c:\python27\Scripts
Installed c:\python27\lib\site-packages\sqlobject-1.3.0-py2.7.egg
Processing dependencies for SQLObject
Finished processing dependencies for SQLObject
|
|
From: Glenn R. <gru...@ed...> - 2012-04-13 16:35:46
|
Nevermind. I would share with you the reason, but I don't want to get banned from The Internet. And yes. I mean 'The Whole Internet'. -Glenn |
|
From: Oleg B. <ph...@ph...> - 2012-03-31 11:49:50
|
On Sat, Mar 31, 2012 at 03:42:38PM +0400, Oleg Broytman wrote:
> I'm pleased to announce version 1.3.0, the first stable release of branch
> 1.3 of SQLObject.
With this release I stopped supporting branch 1.1.
> * Major update of FirebirdConnection: introspection was completely
> rewritten and extended; ``charset`` was renamed to ``dbEncoding``;
> a longstanding bug was fixed - pass port to connect().
Many kudos to Petr Jakes!
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Oleg B. <ph...@ph...> - 2012-03-31 11:42:50
|
Hello! I'm pleased to announce version 1.3.0, the first stable release of branch 1.3 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://pypi.python.org/pypi/SQLObject/1.3.0 News and changes: http://sqlobject.org/News.html What's New ========== Features & Interface -------------------- * PostgresConnection performs translation of exceptions to standard SQLObject's hierarchy of exceptions. * Major update of FirebirdConnection: introspection was completely rewritten and extended; ``charset`` was renamed to ``dbEncoding``; a longstanding bug was fixed - pass port to connect(). For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
|
From: Jeremy H. <jer...@gm...> - 2012-03-27 10:43:12
|
Ok.. thank you. I was under the impression that this function will add an column automatically to my database after I included it in my class. I might code this functionality into sqlmeta. I would find this to be very useful for future changes. Jeremy On Tue, Mar 27, 2012 at 5:32 AM, Oleg Broytman <ph...@ph...> wrote: > On Tue, Mar 27, 2012 at 05:27:45AM -0500, Jeremy Hoyle wrote: > > I added a stringcol to the class Company(SQLObject) table but it did not > > auto update my database with the column. > > You've got it in the reverse direction. fromDatase gets the list of > columns *from* database. If you want to add a column from python to > database you ought to use sqlmeta.addColumn() with changeSchema set to > True. > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
|
From: Oleg B. <ph...@ph...> - 2012-03-27 10:33:00
|
On Tue, Mar 27, 2012 at 05:27:45AM -0500, Jeremy Hoyle wrote:
> I added a stringcol to the class Company(SQLObject) table but it did not
> auto update my database with the column.
You've got it in the reverse direction. fromDatase gets the list of
columns *from* database. If you want to add a column from python to
database you ought to use sqlmeta.addColumn() with changeSchema set to
True.
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Oleg B. <ph...@ph...> - 2012-03-27 09:43:46
|
On Mon, Mar 26, 2012 at 08:02:22PM -0500, Jeremy Hoyle wrote: > fromDatabase boolean doesn't seem to be performing its stated function.It > does not update the database when i enter a new column in the database. I have problems understanding the sentence. Did you add a column to your database and then restarted the program? The program didn't discover the new column? You can test the list of columns by printing Company.sqlmeta.columnList and Company.sqlmeta.columns. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
|
From: Petr J. <pet...@tp...> - 2012-03-27 07:13:25
|
> fromDatabase: A boolean (default false). If true, then on class creation > the database will be queried for the table's columns, and any missing > columns (possible all columns) will be added automatically. > I started with these > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > > Added > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > *Company_Number = StringCol(length = 256, default = None)* > > class Companys(): > def __init__(self): > Company.createTable(ifNotExists = True, connection=conn) > > > Hi Jeremy, what about the Naming Style? see: Changing the Naming Style <http://sqlobject.org/SQLObject.html#id56> .... By default names in SQLObject are expected to be mixed case in Python (like mixedCase), and underscore-separated in SQL (like mixed_case). This applies to table and column names. Regards Petr |
|
From: Jeremy H. <jer...@gm...> - 2012-03-27 01:02:29
|
Sorry.. the previous post was in error. Thank you for your help but although I am not receiving any errors. The fromDatabase boolean doesn't seem to be performing its stated function.It does not update the database when i enter a new column in the database. fromDatabase:A boolean (default false). If true, then on class creation the database will be queried for the table's columns, and any missing columns (possible all columns) will be added automatically. I started with these class Company(SQLObject): class sqlmeta: fromDatabase = True lazyUpdate = False cacheValues = True Company_Name = StringCol(length = 256, default = None) Company_Address = StringCol(length = 256, default = None) Company_Phone = StringCol(length = 256, default = None) Added class Company(SQLObject): class sqlmeta: fromDatabase = True lazyUpdate = False cacheValues = True Company_Name = StringCol(length = 256, default = None) Company_Address = StringCol(length = 256, default = None) Company_Phone = StringCol(length = 256, default = None) *Company_Number = StringCol(length = 256, default = None)* class Companys(): def __init__(self): Company.createTable(ifNotExists = True, connection=conn) Output:>> 2/QueryAll: SHOW COLUMNS FROM store 2/QueryAll: SHOW COLUMNS FROM company 2/Query : DESCRIBE company 2/Query : DESCRIBE store On Mon, Mar 26, 2012 at 7:55 PM, Jeremy Hoyle <jer...@gm...>wrote: > Thank you for your help but although I am not receiving any errors. The > fromDatabase boolean doesn't seem to be performing its stated function. > > fromDatabase: A boolean (default false). If true, then on class creation > the database will be queried for the table's columns, and any missing > columns (possible all columns) will be added automatically. > I started with these > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > > Added > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > On Mon, Mar 26, 2012 at 8:16 AM, Jeremy Hoyle <jer...@gm...>wrote: > >> Ok. I got it. I just defined the connection above and outside the >> Companys and Company classes. Thanks for your help. >> >> Jeremy >> >> >> On Mon, Mar 26, 2012 at 8:05 AM, Oleg Broytman <ph...@ph...> wrote: >> >>> On Mon, Mar 26, 2012 at 07:59:39AM -0500, Jeremy Hoyle wrote: >>> > File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in >>> > <module> >>> > from pySMS import Companys >>> > File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, >>> in >>> > <module> >>> > from Company import Companys >>> >>> Here is the problem now - Company (and Companys) is imported before >>> a connection is created. You have to open a connection before the class >>> Company is created (i.e., before the module is imported). >>> >>> Oleg. >>> -- >>> Oleg Broytman http://phdru.name/ >>> ph...@ph... >>> Programmers don't die, they just GOSUB without RETURN. >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF email is sponsosred by: >>> Try Windows Azure free for 90 days Click Here >>> http://p.sf.net/sfu/sfd2d-msazure >>> _______________________________________________ >>> sqlobject-discuss mailing list >>> sql...@li... >>> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss >>> >> >> > |
|
From: Jeremy H. <jer...@gm...> - 2012-03-27 00:55:33
|
Thank you for your help but although I am not receiving any errors. The
fromDatabase boolean doesn't seem to be performing its stated function.
fromDatabase:A boolean (default false). If true, then on class creation the
database will be queried for the table's columns, and any missing columns
(possible all columns) will be added automatically.
I started with these
class Company(SQLObject):
class sqlmeta:
fromDatabase = True
lazyUpdate = False
cacheValues = True
Company_Name = StringCol(length = 256, default = None)
Company_Address = StringCol(length = 256, default = None)
Company_Phone = StringCol(length = 256, default = None)
Added
class Company(SQLObject):
class sqlmeta:
fromDatabase = True
lazyUpdate = False
cacheValues = True
Company_Name = StringCol(length = 256, default = None)
Company_Address = StringCol(length = 256, default = None)
Company_Phone = StringCol(length = 256, default = None)
Company_Phone = StringCol(length = 256, default = None)
On Mon, Mar 26, 2012 at 8:16 AM, Jeremy Hoyle <jer...@gm...>wrote:
> Ok. I got it. I just defined the connection above and outside the Companys
> and Company classes. Thanks for your help.
>
> Jeremy
>
>
> On Mon, Mar 26, 2012 at 8:05 AM, Oleg Broytman <ph...@ph...> wrote:
>
>> On Mon, Mar 26, 2012 at 07:59:39AM -0500, Jeremy Hoyle wrote:
>> > File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
>> > <module>
>> > from pySMS import Companys
>> > File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1,
>> in
>> > <module>
>> > from Company import Companys
>>
>> Here is the problem now - Company (and Companys) is imported before
>> a connection is created. You have to open a connection before the class
>> Company is created (i.e., before the module is imported).
>>
>> Oleg.
>> --
>> Oleg Broytman http://phdru.name/ ph...@ph...
>> Programmers don't die, they just GOSUB without RETURN.
>>
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> sqlobject-discuss mailing list
>> sql...@li...
>> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>>
>
>
|
|
From: Jeremy H. <jer...@gm...> - 2012-03-26 13:16:20
|
Ok. I got it. I just defined the connection above and outside the Companys and Company classes. Thanks for your help. Jeremy On Mon, Mar 26, 2012 at 8:05 AM, Oleg Broytman <ph...@ph...> wrote: > On Mon, Mar 26, 2012 at 07:59:39AM -0500, Jeremy Hoyle wrote: > > File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in > > <module> > > from pySMS import Companys > > File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in > > <module> > > from Company import Companys > > Here is the problem now - Company (and Companys) is imported before > a connection is created. You have to open a connection before the class > Company is created (i.e., before the module is imported). > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
|
From: Oleg B. <ph...@ph...> - 2012-03-26 13:05:18
|
On Mon, Mar 26, 2012 at 07:59:39AM -0500, Jeremy Hoyle wrote:
> File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
> <module>
> from pySMS import Companys
> File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
> <module>
> from Company import Companys
Here is the problem now - Company (and Companys) is imported before
a connection is created. You have to open a connection before the class
Company is created (i.e., before the module is imported).
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Jeremy H. <jer...@gm...> - 2012-03-26 12:59:50
|
Yes. If I remove Companys as a SQLObject.I still receive the same error.
I'm not sure from the sequence of the ( from Company import Companys ) is
trying to initiate ( class Company(SQLObject) ) class.
class Companys():
def __init__(self):
connection_string = 'mysql://root:ttlan1@127.0.0.1:3306/pySMS'
conn = connectionForURI(connection_string,debug = True,autoCommit =
True)
trans = conn.transaction()
sqlhub.processConnection = conn
Company.createTable(ifNotExists = True, connection=trans)
Traceback (most recent call last):
File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
<module>
from pySMS import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
<module>
from Company import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 137, in
<module>
class Company(SQLObject):
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
line 92, in __new__
cls.__classinit__(cls, new_attrs)
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 789, in __classinit__
sqlmeta.addColumnsFromDatabase()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 441, in addColumnsFromDatabase
conn = connection or soClass._connection
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 902, in __get__
return self.getConnection()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 915, in getConnection
"No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process
On Mon, Mar 26, 2012 at 7:47 AM, Oleg Broytman <ph...@ph...> wrote:
> On Mon, Mar 26, 2012 at 07:42:40AM -0500, Jeremy Hoyle wrote:
> > *Companys is not a sqlobject table. Company is a sqlobject table.
> >
> > class Companys(SQLObject):
>
> I clearly see here that Companys is an SQLObject and hence require a
> connection.
>
> Oleg.
> --
> Oleg Broytman http://phdru.name/ ph...@ph...
> Programmers don't die, they just GOSUB without RETURN.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
|
|
From: Oleg B. <ph...@ph...> - 2012-03-26 12:47:25
|
On Mon, Mar 26, 2012 at 07:42:40AM -0500, Jeremy Hoyle wrote:
> *Companys is not a sqlobject table. Company is a sqlobject table.
>
> class Companys(SQLObject):
I clearly see here that Companys is an SQLObject and hence require a
connection.
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Jeremy H. <jer...@gm...> - 2012-03-26 12:42:52
|
What's that? A global function or a method? Where it's called?
*It is the Companys class. It is called from my test0.py file. See below.*
*
*
The same problem - no connection has been defined. The code tried to
open a connection in Companys.__init__, but Companys is an SQLObject's
table and thus requires an open connection.
Open a connection outside of SQLObject's initialization.
*Companys is not a sqlobject table. Company is a sqlobject table. Sorry for
the confusion. I chose poor naming. Do I not need to extend the SQLObject
in Companys? See all of them below.*
*Company.py file *
class Company(SQLObject):
class sqlmeta:
fromDatabase = True
lazyUpdate = True
cacheValues = True
Company_Name = StringCol(length = 256, default = None)
Company_Address = StringCol(length = 256, default = None)
Company_Phone = StringCol(length = 256, default = None)
class Companys(SQLObject):
def __init__(self):
connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
conn = connectionForURI(connection_string,debug = True,autoCommit
=True)
trans = conn.transaction()
sqlhub.processConnection = conn
Company.createTable(ifNotExists = True, connection=trans)
*test0.py file*
import sys
from sqlobject import *
from pySMS import Companys
if __name__ == "__main__":
pysoft = Companys()
On Mon, Mar 26, 2012 at 4:42 AM, Oleg Broytman <ph...@ph...> wrote:
> On Mon, Mar 26, 2012 at 04:30:26AM -0500, Jeremy Hoyle wrote:
> > Thank you for your response. I'm sorry for not including these details
> for
> > I have been struggling with this problem for sometime. These suggestions
> > have been tried or already implemented with the same result. Pleased let
> me
> > know if you have any other suggestions.
> >
> > def __init__(self):
> > connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
> > conn = connectionForURI(connection_string,debug = True,autoCommit =
> > True)
> > trans = conn.transaction()
> > sqlhub.processConnection = conn
> > Company.createTable(ifNotExists = True, connection=trans)
>
> What's that? A global function or a method? Where it's called?
>
> > test0.py file
> >
> > import sys
> > from sqlobject import *
> > from pySMS import Companys
> >
> > if __name__ == "__main__":
> >
> > pysoft = Companys()
> >
> >
> > Traceback (most recent call last):
> > File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
> > <module>
> > from pySMS import Companys
> > File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
> > <module>
> > from Company import Companys
> > File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 137,
> in
> > <module>
> > class Company(SQLObject):
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
> > line 92, in __new__
> > cls.__classinit__(cls, new_attrs)
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> > line 789, in __classinit__
> > sqlmeta.addColumnsFromDatabase()
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> > line 441, in addColumnsFromDatabase
> > conn = connection or soClass._connection
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> > line 902, in __get__
> > return self.getConnection()
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> > line 915, in getConnection
> > "No connection has been defined for this thread "
> > AttributeError: No connection has been defined for this thread or process
>
> The same problem - no connection has been defined. The code tried to
> open a connection in Companys.__init__, but Companys is an SQLObject's
> table and thus requires an open connection.
> Open a connection outside of SQLObject's initialization.
>
> Oleg.
> --
> Oleg Broytman http://phdru.name/ ph...@ph...
> Programmers don't die, they just GOSUB without RETURN.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
|
|
From: Oleg B. <ph...@ph...> - 2012-03-26 09:42:39
|
On Mon, Mar 26, 2012 at 04:30:26AM -0500, Jeremy Hoyle wrote:
> Thank you for your response. I'm sorry for not including these details for
> I have been struggling with this problem for sometime. These suggestions
> have been tried or already implemented with the same result. Pleased let me
> know if you have any other suggestions.
>
> def __init__(self):
> connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
> conn = connectionForURI(connection_string,debug = True,autoCommit =
> True)
> trans = conn.transaction()
> sqlhub.processConnection = conn
> Company.createTable(ifNotExists = True, connection=trans)
What's that? A global function or a method? Where it's called?
> test0.py file
>
> import sys
> from sqlobject import *
> from pySMS import Companys
>
> if __name__ == "__main__":
>
> pysoft = Companys()
>
>
> Traceback (most recent call last):
> File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
> <module>
> from pySMS import Companys
> File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
> <module>
> from Company import Companys
> File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 137, in
> <module>
> class Company(SQLObject):
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
> line 92, in __new__
> cls.__classinit__(cls, new_attrs)
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> line 789, in __classinit__
> sqlmeta.addColumnsFromDatabase()
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> line 441, in addColumnsFromDatabase
> conn = connection or soClass._connection
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> line 902, in __get__
> return self.getConnection()
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> line 915, in getConnection
> "No connection has been defined for this thread "
> AttributeError: No connection has been defined for this thread or process
The same problem - no connection has been defined. The code tried to
open a connection in Companys.__init__, but Companys is an SQLObject's
table and thus requires an open connection.
Open a connection outside of SQLObject's initialization.
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Jeremy H. <jer...@gm...> - 2012-03-26 09:30:36
|
Thank you for your response. I'm sorry for not including these details for
I have been struggling with this problem for sometime. These suggestions
have been tried or already implemented with the same result. Pleased let me
know if you have any other suggestions.
def __init__(self):
connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
conn = connectionForURI(connection_string,debug = True,autoCommit =
True)
trans = conn.transaction()
sqlhub.processConnection = conn
Company.createTable(ifNotExists = True, connection=trans)
test0.py file
import sys
from sqlobject import *
from pySMS import Companys
if __name__ == "__main__":
pysoft = Companys()
Traceback (most recent call last):
File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
<module>
from pySMS import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
<module>
from Company import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 137, in
<module>
class Company(SQLObject):
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
line 92, in __new__
cls.__classinit__(cls, new_attrs)
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 789, in __classinit__
sqlmeta.addColumnsFromDatabase()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 441, in addColumnsFromDatabase
conn = connection or soClass._connection
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 902, in __get__
return self.getConnection()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 915, in getConnection
"No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process
On Mon, Mar 26, 2012 at 3:52 AM, Oleg Broytman <ph...@ph...> wrote:
> Hi!
>
> On Sun, Mar 25, 2012 at 06:56:32PM -0500, Jeremy Hoyle wrote:
> > I have a problem while trying to use the "fromDatabase = True" option in
> > sqlmeta. Any time I enable this. it gives me the connection error below.
> Is
> > there another attribute I need to do before doing this? I saw another
> > thread with this problem but the solution was enable the connection
> before
> > the class which I have done.
> >
> > from sqlobject import *
> >
> > class Companys(SQLObject):
> > def __init__(self):
> > connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
> > conn = connectionForURI(connection_string,debug =
> True,autoCommit =
> > True)
> > trans = conn.transaction()
> > sqlhub.processConnection = conn
> > Company.createTable(ifNotExists = True, connection=conn)
> > Company._connection.debug = True
>
> A number of problems here.
> 1. The connection is created in Companys.__init__ which is not called,
> at least it is not called when SQLObject's metaclass processes
> fromDatabase. fromDatabase requires an open connection.
> 2. A transaction is opened but never used. Transaction (trans, in your
> case) has to be used instead of connection (in sqlhub, or in every
> SQLObject call that accepts connection).
>
> > class Company(SQLObject):
> >
> > class sqlmeta:
> > fromDatabase = True
> > lazyUpdate = True
> > cacheValues = True
> >
> > Company_Name = StringCol(length = 256, default = None)
> > Company_Address = StringCol(length = 256, default = None)
> > Company_Phone = StringCol(length = 256, default = None)
> >
> > Traceback (most recent call last):
> > File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
> > <module>
> > from pySMS import Companys
> > File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
> > <module>
> > from Company import Companys
> > File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 138,
> in
> > <module>
> > class Company(SQLObject):
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
> > line 92, in __new__
> > cls.__classinit__(cls, new_attrs)
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> > line 789, in __classinit__
> > sqlmeta.addColumnsFromDatabase()
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> > line 441, in addColumnsFromDatabase
> > conn = connection or soClass._connection
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> > line 902, in __get__
> > return self.getConnection()
> > File
> >
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> > line 915, in getConnection
> > "No connection has been defined for this thread "
> > AttributeError: No connection has been defined for this thread or process
>
> Oleg.
> --
> Oleg Broytman http://phdru.name/ ph...@ph...
> Programmers don't die, they just GOSUB without RETURN.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
|
|
From: Oleg B. <ph...@ph...> - 2012-03-26 08:52:38
|
Hi!
On Sun, Mar 25, 2012 at 06:56:32PM -0500, Jeremy Hoyle wrote:
> I have a problem while trying to use the "fromDatabase = True" option in
> sqlmeta. Any time I enable this. it gives me the connection error below. Is
> there another attribute I need to do before doing this? I saw another
> thread with this problem but the solution was enable the connection before
> the class which I have done.
>
> from sqlobject import *
>
> class Companys(SQLObject):
> def __init__(self):
> connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
> conn = connectionForURI(connection_string,debug = True,autoCommit =
> True)
> trans = conn.transaction()
> sqlhub.processConnection = conn
> Company.createTable(ifNotExists = True, connection=conn)
> Company._connection.debug = True
A number of problems here.
1. The connection is created in Companys.__init__ which is not called,
at least it is not called when SQLObject's metaclass processes
fromDatabase. fromDatabase requires an open connection.
2. A transaction is opened but never used. Transaction (trans, in your
case) has to be used instead of connection (in sqlhub, or in every
SQLObject call that accepts connection).
> class Company(SQLObject):
>
> class sqlmeta:
> fromDatabase = True
> lazyUpdate = True
> cacheValues = True
>
> Company_Name = StringCol(length = 256, default = None)
> Company_Address = StringCol(length = 256, default = None)
> Company_Phone = StringCol(length = 256, default = None)
>
> Traceback (most recent call last):
> File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
> <module>
> from pySMS import Companys
> File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
> <module>
> from Company import Companys
> File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 138, in
> <module>
> class Company(SQLObject):
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
> line 92, in __new__
> cls.__classinit__(cls, new_attrs)
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> line 789, in __classinit__
> sqlmeta.addColumnsFromDatabase()
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
> line 441, in addColumnsFromDatabase
> conn = connection or soClass._connection
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> line 902, in __get__
> return self.getConnection()
> File
> "C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
> line 915, in getConnection
> "No connection has been defined for this thread "
> AttributeError: No connection has been defined for this thread or process
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|
|
From: Jeremy H. <jer...@gm...> - 2012-03-25 23:56:39
|
I have a problem while trying to use the "fromDatabase = True" option in
sqlmeta. Any time I enable this. it gives me the connection error below. Is
there another attribute I need to do before doing this? I saw another
thread with this problem but the solution was enable the connection before
the class which I have done.
from sqlobject import *
class Companys(SQLObject):
def __init__(self):
connection_string = 'mysql://user:password@127.0.0.1:3306/pySMS'
conn = connectionForURI(connection_string,debug = True,autoCommit =
True)
trans = conn.transaction()
sqlhub.processConnection = conn
Company.createTable(ifNotExists = True, connection=conn)
Company._connection.debug = True
class Company(SQLObject):
class sqlmeta:
fromDatabase = True
lazyUpdate = True
cacheValues = True
Company_Name = StringCol(length = 256, default = None)
Company_Address = StringCol(length = 256, default = None)
Company_Phone = StringCol(length = 256, default = None)
Traceback (most recent call last):
File "C:\Pysoft\Software\SMS Development\tests\test0.py", line 5, in
<module>
from pySMS import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\__init__.py", line 1, in
<module>
from Company import Companys
File "C:\Pysoft\Software\SMS Development\pySMS\Company.py", line 138, in
<module>
class Company(SQLObject):
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\declarative.py",
line 92, in __new__
cls.__classinit__(cls, new_attrs)
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 789, in __classinit__
sqlmeta.addColumnsFromDatabase()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\main.py",
line 441, in addColumnsFromDatabase
conn = connection or soClass._connection
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 902, in __get__
return self.getConnection()
File
"C:\Python27\lib\site-packages\sqlobject-1.2.1-py2.7.egg\sqlobject\dbconnection.py",
line 915, in getConnection
"No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process
|
|
From: Hans G. S. <geo...@sc...> - 2012-03-18 19:00:58
|
> Archives are listed at http://sqlobject.org/community.html Indeed. Sorry. I misread that sentence and thought it referred to a different list. Silly me. > The bug has been fixed in SQLObject 1.2. Consider upgrading to a > later version. Brilliant. Thank you very much. It is either that, or just pray patiently that Ubuntu will upgrade it in the next release next month :-) :-- George |
|
From: Oleg B. <ph...@ph...> - 2012-03-18 18:10:10
|
On Sun, Mar 18, 2012 at 06:50:07PM +0100, Hans Georg Schaathun wrote: > sorry if this is an old topic, but I did not find any list > archive. Archives are listed at http://sqlobject.org/community.html > I just took up using SQLObject a few weeks ago; > very convenient. > > File > "/usr/lib/pymodules/python2.7/sqlobject/postgres/pgconnection.py", line > 133, in makeConnection > conn.autocommit(1) > TypeError: 'bool' object is not callable The bug has been fixed in SQLObject 1.2. Consider upgrading to a later version. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
|
From: Hans G. S. <geo...@sc...> - 2012-03-18 17:50:18
|
Hi, sorry if this is an old topic, but I did not find any list archive. I just took up using SQLObject a few weeks ago; very convenient. I wonder if anyone has experience with a bug where the the postgress connection attempts to call a boolean value (autocommit) as a method. (Call stack is cut in below.) It is not a new problem, I found it reported here as well: http://stackoverflow.com/questions/6374121/python-why-does-sqlobject-fail-in-conn-autocommit1 What is odd is that my code works fine on Ubuntu 10.4 with a connection to localhost. When I run the same code on Ubuntu 10.10 with a remote server, it fails. I am not sure if the difference is with the remoteness or the software version ... So far I have tried to make do with the standard ubuntu packages for sqlobject and postgres. Does anyone know if this problem has been resolved in some recent version of sqlobject/psycopg? Or if there is a known workaround? I do observe that the URL below suggests what looks like a downgrading of psycopg2, which I won't do if upgrading is an option :-) My call stack is: File "/home/georg/git/pysteg/src/pysteg/sql/tables.py", line 346, in getJob trans = conn.transaction() File "/usr/lib/pymodules/python2.7/sqlobject/dbconnection.py", line 400, in transaction return Transaction(self) File "/usr/lib/pymodules/python2.7/sqlobject/dbconnection.py", line 686, in __init__ self._connection = dbConnection.getConnection() File "/usr/lib/pymodules/python2.7/sqlobject/dbconnection.py", line 271, in getConnection conn = self.makeConnection() File "/usr/lib/pymodules/python2.7/sqlobject/postgres/pgconnection.py", line 133, in makeConnection conn.autocommit(1) TypeError: 'bool' object is not callable Thanks a lot in advance, :-- George |
|
From: Oleg B. <ph...@ph...> - 2012-03-01 16:08:02
|
Hello! I'm pleased to announce version 1.2.2, a bugfix release of branch 1.2 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://pypi.python.org/pypi/SQLObject/1.2.2 News and changes: http://sqlobject.org/News.html What's New ========== * A bug was fixed in SQLiteConnection - clear _threadPool on close(). For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
|
From: Oleg B. <ph...@ph...> - 2012-03-01 16:07:31
|
Hello! I'm pleased to announce version 1.1.5, a bugfix release of branch 1.1 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://pypi.python.org/pypi/SQLObject/1.1.5 News and changes: http://sqlobject.org/News.html What's New ========== * A bug was fixed in SQLiteConnection - clear _threadPool on close(). For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
|
From: Oleg B. <ph...@ph...> - 2012-02-28 19:20:37
|
On Tue, Feb 28, 2012 at 01:56:50PM -0500, Markos Kapes wrote:
> Out[21]: Title is: title names are: [u'publisher', u'isbn', 'kind_id', 'booktitle', u'release_date', u'edition', u'tag', u'type'] values are: [' ', ' ', 1, '\xc3\xa9tape', None, None, None, None]
> So, yes, there are unicode strings in the names.
To fix that edit sqlobject/mysql/mysqlconnection.py, method
columnsFromSchema; search for assignments
kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field)
kw['dbName'] = field
make them strings:
kw['name'] = str(soClass.sqlmeta.style.dbColumnToPythonAttr(field))
kw['dbName'] = str(field)
test and report if that helps.
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|