Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares

Michael Bayer wrote:

On Dec 17, 2011, at 1:52 AM, jo wrote:

  

create_engine(oracle://user:password@SHELL)

 
  

could you tell me how it becomes in sqlalchemy.dburi on tg prod.cfg ?

sqlalchemy.dburi=oracle://username:password@host:port/service_name

I tried in this way:
sqlalchemy.dburi=oracle://username:password@SHELL:1521/SHELL
but...
sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12545: Connect failed because 
target host or object does not exist



er, without the /db or port, host becomes the tns name, as in the example:

sqlalchemy.dburi=oracle://user:password@SHELL

SHELL is a tns name, cx_oracle looks it up in the local tnsnames file to get 
all the correct connection information.



  

I tried as you said Michael and this is the error message:

sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not 
resolve the connect identifier specified



I tried like so:

sqlalchemy.dburi=oracle://user:password@SHELL


and I also tried using the port number:

sqlalchemy.dburi=oracle://user:password@SHELL:1521

but the error is always the same.
j


--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] performance vs. psycopg2

2011-12-19 Thread Gaëtan de Menten
On Fri, Dec 16, 2011 at 15:58, Jon Nelson jnel...@jamponi.net wrote:

 Revised to use:

 for row in rows:
  dict(row) # throw away result
  count += 1

I wonder how this could even work... iterating over the row yields
individual values, not tuples?!

I wonder what kind of column types you are using. Could you post your
code for both your tests (with and without SA)?

 SQLAlchemy: 115,000 to 120,000 rows/s (vs. psycopg2 @ 480K - 580K, or
 psycopg2 COPY @ 620K).

 I suspect the issue is that I'm only selecting one column, so the
 per-row overhead is exaggerated.

That is certainly a factor but even then, your numbers seem strange
(at least to me).

-- 
Gaëtan de Menten

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] Re: Error after upgrading from v0.6.6 to 0.7.4

2011-12-19 Thread useher
Hi!

Sorry for the late answer.
I got it now: There was a relation called 'status' in the parent class
and a function called status() in the derived class. After renaming
the function everything seems to work correct.
So the error does not belong to sqlalchemy, but concerns some bad
coding by myself.
A short description is below the message.

Thank you very much for your help!

Uwe Seher



What i have done:
changes in mapper.py:

def _is_userland_descriptor(self, obj):
try:
return not isinstance(obj,
(MapperProperty, attributes.QueryableAttribute))
and \
hasattr(obj, '__get__') and not \
 isinstance(obj.__get__(None, obj),
attributes.QueryableAttribute)
except:
import pdb, sys
e,m,tb = sys.exc_info()
pdb.post_mortem(tb)

What happens:
uwe@pallas:~/dev/python/endb ./test_api.py
/usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:42:
SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'], useexisting=True)
/usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:51:
SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'],  useexisting=True)
/usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-
x86_64.egg/sqlalchemy/ext/declarative.py:1172: SADeprecationWarning:
useexisting is deprecated.  Use extend_existing.
  **table_kw)
 /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-x86_64.egg/sqlalchemy/orm/mapper.py(1459)_is_userland_descriptor()
- isinstance(obj.__get__(None, obj),
(Pdb) args
self = Mapper|Facility|facilities
obj = unbound method Facility.status
(Pdb)

The error does not happen anymore when importing the lib in idle, but
when running my testscript and using it.
The method in obj looks like this and is not finished at the moment.
If i comment it out, everything works.


On 15 Dez., 16:48, Michael Bayer mike...@zzzcomputing.com wrote:
 On Dec 15, 2011, at 2:38 AM, useher wrote:

  I write a library with some classes that has to bundle function for
  different applications accessing data on a PostgreSQL-9.x Server.
  sqlalchemy is installed and maintained by easy_install not by
  packetmanagement. After upgrading to 0.7.4 the following error occurs:

   File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
  1481, in _should_exclude
   File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
  1458, in _is_userland_descriptor
  TypeError: Error when calling the metaclass bases
     issubclass() arg 1 must be a class

 I need to see what arg actually is here - you'll note the SQLAlchemy code 
 in question isn't calling issubclass(), it's calling isinstance().  It 
 suggests that SQLA's invocation of the descriptor itself is resulting in an 
 issubclass() call, though when I try to simulate this error the stack trace 
 is explicit:

   File /Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/mapper.py, line 
 1458, in _is_userland_descriptor
     isinstance(obj.__get__(None, obj),
   File test.py, line 9, in __get__
     if issubclass(owner, object):
 TypeError: Error when calling the metaclass bases
     issubclass() arg 1 must be a class

 so not sure why the actual source of issubclass() is not present in your 
 stack trace.

 Can you just pdb into that section using pdb.post_mortem() and figure out 
 what the descriptor in question is actually doing ?    I'd like to understand 
 what's going on before just putting in a blunt except:.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] Re: Error after upgrading from v0.6.6 to 0.7.4

2011-12-19 Thread useher
Hi!

Sorry for the late answer.
I got it now: There was a relation called 'status' in the parent class
and a function called status() in the derived class. After renaming
the function everything seems to work correct.
So the error does not belong to sqlalchemy, but concerns some bad
coding by myself.
A short description is below the message.

Thank you very much for your help!

Uwe Seher



What i have done:
changes in mapper.py:

def _is_userland_descriptor(self, obj):
try:
return not isinstance(obj,
(MapperProperty, attributes.QueryableAttribute))
and \
hasattr(obj, '__get__') and not \
 isinstance(obj.__get__(None, obj),
attributes.QueryableAttribute)
except:
import pdb, sys
e,m,tb = sys.exc_info()
pdb.post_mortem(tb)

What happens:
uwe@pallas:~/dev/python/endb ./test_api.py
/usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:42:
SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'], useexisting=True)
/usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:51:
SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'],  useexisting=True)
/usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-
x86_64.egg/sqlalchemy/ext/declarative.py:1172: SADeprecationWarning:
useexisting is deprecated.  Use extend_existing.
  **table_kw)
 /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-x86_64.egg/sqlalchemy/orm/mapper.py(1459)_is_userland_descriptor()
- isinstance(obj.__get__(None, obj),
(Pdb) args
self = Mapper|Facility|facilities
obj = unbound method Facility.status
(Pdb)

The error does not happen anymore when importing the lib in idle, but
when running my testscript and using it.
The method in obj looks like this and is not finished at the moment.
If i comment it out, everything works.


On 15 Dez., 16:48, Michael Bayer mike...@zzzcomputing.com wrote:
 On Dec 15, 2011, at 2:38 AM, useher wrote:

  I write a library with some classes that has to bundle function for
  different applications accessing data on a PostgreSQL-9.x Server.
  sqlalchemy is installed and maintained by easy_install not by
  packetmanagement. After upgrading to 0.7.4 the following error occurs:

   File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
  1481, in _should_exclude
   File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
  1458, in _is_userland_descriptor
  TypeError: Error when calling the metaclass bases
     issubclass() arg 1 must be a class

 I need to see what arg actually is here - you'll note the SQLAlchemy code 
 in question isn't calling issubclass(), it's calling isinstance().  It 
 suggests that SQLA's invocation of the descriptor itself is resulting in an 
 issubclass() call, though when I try to simulate this error the stack trace 
 is explicit:

   File /Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/mapper.py, line 
 1458, in _is_userland_descriptor
     isinstance(obj.__get__(None, obj),
   File test.py, line 9, in __get__
     if issubclass(owner, object):
 TypeError: Error when calling the metaclass bases
     issubclass() arg 1 must be a class

 so not sure why the actual source of issubclass() is not present in your 
 stack trace.

 Can you just pdb into that section using pdb.post_mortem() and figure out 
 what the descriptor in question is actually doing ?    I'd like to understand 
 what's going on before just putting in a blunt except:.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] How to work with python3.2 and mysql?

2011-12-19 Thread Florent Angebault
Le 18/12/2011 19:07, Michael Bayer a écrit :

On Dec 18, 2011, at 6:29 AM, Florent Angebault wrote:

Hello.

I tried many different configurations to connect to mysql5 server using 
python3.2 and sqlalchemy 0.7.4 but couldn't have success.
I always end with an error due to the fact that some string data is of type 
'bytes' instead of 'str'.

Below are 2 test cases that both fail.
The first one uses PyMySQL3-0.5 and the second one uses 
mysql-connector-0.3.2-devel.
I don't know if I made mistakes with my configuration, or if it's a bug I 
should report.

If I made a mistake, I'd be glad if someone could give me a link to the 
appropriate documentation.
If it's a bug, I don't know where I should report it: sqlalchemy, 
mysqlconnector or pymysql project?

OK well take a look at supported DBs:

http://www.sqlalchemy.org/docs/core/engines.html#supported-databases

The only drivers supported for MySQL + Py3K are OurSQL and 
MySQL-connector/python.  In particular OurSQL runs pretty well and is on our 
continuous integration environment, with not quite all but most tests passing.
I tried oursql and had some difficulties to have it work correctly: I managed 
to compile version 0.9.2 but then I had to patch it a bit (bug #805983 that 
seems to be fixed in 0.9.3).
Version 0.9.3 for py3k is not released yet and I failed to compile it (I'm not 
familiar with those compilation things).

My locally-patched oursql-0.9.2 is currently good enough for me to continue 
working.
When I have more time (or when I'll encounter another problem with oursql) I'll 
give another try to MySQL-connector/python.

Thanks for your help.


--
Florent Angebault

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Re: Error after upgrading from v0.6.6 to 0.7.4

2011-12-19 Thread Michael Bayer

On Dec 19, 2011, at 5:03 AM, useher wrote:

 Hi!
 
 Sorry for the late answer.
 I got it now: There was a relation called 'status' in the parent class
 and a function called status() in the derived class. After renaming
 the function everything seems to work correct.
 So the error does not belong to sqlalchemy, but concerns some bad
 coding by myself.
 A short description is below the message.
 
 Thank you very much for your help!

thanks for the info !  I've captured this as 
http://www.sqlalchemy.org/trac/ticket/2352 where we might add a more 
informative error message.




 
 Uwe Seher
 
 
 
 What i have done:
 changes in mapper.py:
 
def _is_userland_descriptor(self, obj):
try:
return not isinstance(obj,
(MapperProperty, attributes.QueryableAttribute))
 and \
hasattr(obj, '__get__') and not \
 isinstance(obj.__get__(None, obj),
attributes.QueryableAttribute)
except:
import pdb, sys
e,m,tb = sys.exc_info()
pdb.post_mortem(tb)
 
 What happens:
 uwe@pallas:~/dev/python/endb ./test_api.py
 /usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:42:
 SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'], useexisting=True)
 /usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:51:
 SADeprecationWarning: useexisting is deprecated.  Use extend_existing.
  schema=schemata['pub'],  useexisting=True)
 /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-
 x86_64.egg/sqlalchemy/ext/declarative.py:1172: SADeprecationWarning:
 useexisting is deprecated.  Use extend_existing.
  **table_kw)
 /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-x86_64.egg/sqlalchemy/orm/mapper.py(1459)_is_userland_descriptor()
 - isinstance(obj.__get__(None, obj),
 (Pdb) args
 self = Mapper|Facility|facilities
 obj = unbound method Facility.status
 (Pdb)
 
 The error does not happen anymore when importing the lib in idle, but
 when running my testscript and using it.
 The method in obj looks like this and is not finished at the moment.
 If i comment it out, everything works.
 
 
 On 15 Dez., 16:48, Michael Bayer mike...@zzzcomputing.com wrote:
 On Dec 15, 2011, at 2:38 AM, useher wrote:
 
 I write a library with some classes that has to bundle function for
 different applications accessing data on a PostgreSQL-9.x Server.
 sqlalchemy is installed and maintained by easy_install not by
 packetmanagement. After upgrading to 0.7.4 the following error occurs:
 
  File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
 1481, in _should_exclude
  File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line
 1458, in _is_userland_descriptor
 TypeError: Error when calling the metaclass bases
issubclass() arg 1 must be a class
 
 I need to see what arg actually is here - you'll note the SQLAlchemy code 
 in question isn't calling issubclass(), it's calling isinstance().  It 
 suggests that SQLA's invocation of the descriptor itself is resulting in an 
 issubclass() call, though when I try to simulate this error the stack trace 
 is explicit:
 
   File /Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/mapper.py, line 
 1458, in _is_userland_descriptor
 isinstance(obj.__get__(None, obj),
   File test.py, line 9, in __get__
 if issubclass(owner, object):
 TypeError: Error when calling the metaclass bases
 issubclass() arg 1 must be a class
 
 so not sure why the actual source of issubclass() is not present in your 
 stack trace.
 
 Can you just pdb into that section using pdb.post_mortem() and figure out 
 what the descriptor in question is actually doing ?I'd like to 
 understand what's going on before just putting in a blunt except:.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares

Michael Bayer wrote:

On Dec 19, 2011, at 3:28 AM, jose soares wrote:

  

I tried as you said Michael and this is the error message:

sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not resolve 
the connect identifier specified


I tried like so:

sqlalchemy.dburi=oracle://user:password@SHELL


and I also tried using the port number:

sqlalchemy.dburi=oracle://user:password@SHELL:1521

but the error is always the same.
j




OK, but if you connect with cx_oracle:

cx_Oracle.connect(user='user', password='password', dsn='SHELL')

then it connects ? it should be the exact same thing.


  

not in this way:

cx_Oracle.connect(user='user', password='password', dsn='SHELL')


but in this way:

cx_Oracle.connect(user='user', password='password', 
dsn=cx_Oracle.makedsn('myhost',1521,'SHELL').replace('SID','SERVICE_NAME'))



j

--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread Michael Bayer

On Dec 19, 2011, at 10:17 AM, jose soares wrote:

 Michael Bayer wrote:
 On Dec 19, 2011, at 3:28 AM, jose soares wrote:
 
  
 I tried as you said Michael and this is the error message:
 
 sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not 
 resolve the connect identifier specified
 
 
 I tried like so:
 
 sqlalchemy.dburi=oracle://user:password@SHELL
 
 
 and I also tried using the port number:
 
 sqlalchemy.dburi=oracle://user:password@SHELL:1521
 
 but the error is always the same.
 j

 
 
 OK, but if you connect with cx_oracle:
 
 cx_Oracle.connect(user='user', password='password', dsn='SHELL')
 
 then it connects ? it should be the exact same thing.
 
 
  
 not in this way:
 
 cx_Oracle.connect(user='user', password='password', dsn='SHELL')
 
 
 but in this way:
 
 cx_Oracle.connect(user='user', password='password', 
 dsn=cx_Oracle.makedsn('myhost',1521,'SHELL').replace('SID','SERVICE_NAME'))

this is weird.  What's in your tnsnames.ora ?Is there the chance that just 
modifying tnsnames.ora or adding a new entry would solve this ?

Sorry for all the questions I just need to determine what SQLAlchemy should do 
here, either add some new connect styles or just tell users to modify their tns 
files


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares

Michael Bayer wrote:

On Dec 19, 2011, at 10:17 AM, jose soares wrote:

  

Michael Bayer wrote:


On Dec 19, 2011, at 3:28 AM, jose soares wrote:

 
  

I tried as you said Michael and this is the error message:

sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not resolve 
the connect identifier specified


I tried like so:

sqlalchemy.dburi=oracle://user:password@SHELL


and I also tried using the port number:

sqlalchemy.dburi=oracle://user:password@SHELL:1521

but the error is always the same.
j
   


OK, but if you connect with cx_oracle:

cx_Oracle.connect(user='user', password='password', dsn='SHELL')

then it connects ? it should be the exact same thing.


 
  

not in this way:

cx_Oracle.connect(user='user', password='password', dsn='SHELL')


but in this way:

cx_Oracle.connect(user='user', password='password', 
dsn=cx_Oracle.makedsn('myhost',1521,'SHELL').replace('SID','SERVICE_NAME'))



this is weird.  What's in your tnsnames.ora ?Is there the chance that just 
modifying tnsnames.ora or adding a new entry would solve this ?

Sorry for all the questions I just need to determine what SQLAlchemy should do 
here, either add some new connect styles or just tell users to modify their tns 
files


  

this is my tnsnames.ora:

# tnsnames.ora Network Configuration File: 
/usr/share/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_SICER =
 (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))


SFERACARTA_CONN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))
(CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = SHELL))
)


--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread Michael Bayer

On Dec 19, 2011, at 10:43 AM, jose soares wrote:

 this is my tnsnames.ora:
 
 # tnsnames.ora Network Configuration File: 
 /usr/share/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.
 
 LISTENER_SICER =
 (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))
 
 
 SFERACARTA_CONN =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))
 (CONNECT_DATA =
   (SERVER = DEDICATED)
   (SERVICE_NAME = SHELL))
 )

so if you added (SID = SHELL) underneath the SERVICE_NAME, what happens ?
I've used Oracle for well over twelve years and still have no clue what the 
difference between SERVICE_NAME and SID is.




-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares

Michael Bayer wrote:

On Dec 19, 2011, at 10:43 AM, jose soares wrote:

  

this is my tnsnames.ora:

# tnsnames.ora Network Configuration File: 
/usr/share/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_SICER =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))


SFERACARTA_CONN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net )(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = SHELL))
)



so if you added (SID = SHELL) underneath the SERVICE_NAME, what happens ?
I've used Oracle for well over twelve years and still have no clue what the 
difference between SERVICE_NAME and SID is.




  

if I change SERVICE_NAME with SID the error returns:

sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener 
does not currently know of SID given in connect descriptor



How SID is different from SERVICE_NAME in oracle tnsnames.ora?
In short: SID = the unique name of your DB,
Service_name = the alias used when connecting
http://stackoverflow.com/questions/43866/how-sid-is-different-from-service-name-in-oracle-tnsnames-ora


--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] help decrypting exception re session management error?

2011-12-19 Thread Iain Duncan
Ok, I know this is my fault but maybe someone can help me know what kind of
error I'm producing here, in saving a user, I'm getting the following
expection, but only occasionally ( like 10% of the time? )

15:13:18,160 INFO [xornot.dram.views] EditAction.post() Exception from
self.update: Can't attach instance Group at 0xb660d6c; another instance
with key (class 'xornot.auth.model.group.Group', (3L,)) is already
present in this session.

I suspect it as to do with this code which tries to add the everyone group
to everyone before update:

def pre_update_hook(self):
  log.info(UserActionMixing.pre_update_hook())
  # users can never be removed from the Everyone group
  everyone = self.model.get_by(Group, name='Everyone')
  admin = self.model.get_by(Group, name='Admin')
  if everyone not in self.valid_values['groups']:
self.valid_values['groups'].append(everyone)

It's a long shot, but does the above info give anyone any idea what kind of
thing I might be doing wrong and how to track down something like this?

thanks
Iain

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.