Hi Toninho

Looks to me that the issue is that your original create_engine is connecting
to the DB /newscom3, which you have not yet created. (i.e. you are just
about to create it, but it does not exist YET).

I'm not sure exactly (so forgive me if I'm wrong) but I would assume you
would possibly need to connect to another DB and then create newcom3 and
then create a new engine connected to the newly created DB..

Worth a try anyway!  :-)

Cheers
Warwick

On 23 February 2011 07:45, Toninho Nunes <toninhonu...@gmail.com> wrote:

> Hi see my source code below
>
> import sqlalchemy
> import psycopg2
> from sqlalchemy import create_engine, Table, MetaData, Integer,
> String, ForeignKey, Column, LargeBinary
> from sqlalchemy.sql import text
>
>
> db_engine = create_engine('postgresql+psycopg2://
> postgres:password@localhost/newscom3', echo=True)
>
> db_engine.raw_connection().set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
> db_engine.text("CREATE DATABASE newscom3 WITH OWNER = postgres
> ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'pt_BR.utf8'
> LC_CTYPE = 'pt_BR.utf8' CONNECTION LIMIT = -1;").execute()
>
> metadata = MetaData()
> metadata.create_all(db_engine)
>
> I run the source code, but I receive the following error.
>
> Traceback (most recent call last):
>  File "newscomddl.py", line 18, in <module>
>
>
> db_engine.raw_connection().set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/base.py", line 1874, in raw_connection
>    return self.pool.unique_connection()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 142, in unique_connection
>    return _ConnectionFairy(self).checkout()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 369, in __init__
>    rec = self._connection_record = pool.get()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 213, in get
>    return self.do_get()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 732, in do_get
>    con = self.create_connection()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 147, in create_connection
>    return _ConnectionRecord(self)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 253, in __init__
>    self.connection = self.__connect()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/pool.py", line 319, in __connect
>    connection = self.__pool._creator()
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/strategies.py", line 82, in connect
>    return dialect.connect(*cargs, **cparams)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/default.py", line 249, in connect
>    return self.dbapi.connect(*cargs, **cparams)
> sqlalchemy.exc.OperationalError: (OperationalError) FATAL:  database
> "newscom3" does not exist
>  None None
>
> I don't get know where are wrong, could you help me?
>
> Thanks,
>
> Toninho Nunes
>
> --
> 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.

Reply via email to