Re: [Modeling-users] 1. Permission denied during SELECT 2. Aggregations
Status: Abandoned
Brought to you by:
sbigaret
|
From: Sebastien B. <sbi...@us...> - 2003-11-10 12:17:03
|
Hi,
<luk...@po...> wrote:
> 1.
> I've got some problems under Windows with Modeling and/or PostgreSQL. I =
did
> exactly like it is said in "quick overview" and I used Persons and Adress=
es.
> The verifcation and Python object creation was successful, but when I run
> script (a bit simplified than in overview):
[...]
> ec=3DEditingContext()
> os.environ['MDL_ENABLE_DATABASE_LOGGING']=3D'1';
> os.environ['MDL_PREFERRED_PYTHON_POSTGRESQL_ADAPTOR']=3D'pypgsql'
> # fetch objects
> in_london=3Dec.fetch('Person')
> [(p.getLastName(), p.getFirstName()) for p in in_london]
> except:
> print 'errors',
> raise;
> #------------------------------------
>=20
> i got this error message:
>=20
> Traceback (most recent call last):
> File "uzycie.py", line 28, in ?
> in_london=3Dec.fetch('Person')
[...]
> "C:\PROGRA~1\Zope2.6.2\bin\Modeling\DatabaseAdaptors\AbstractDBAPI2Adapto=
rLa
> yer\AbstractDBAPI2AdaptorChannel.py",
> line 297, in selectAttributes
> raise GeneralAdaptorException, msg
> Modeling.Adaptor.GeneralAdaptorException: Couldn't evaluate expression
> SELECT t0.ID, t0.FIRST_NAME, t0.LAST_NAME FROM PERSON t0. Reason:
> libpq.OperationalError:ERROR: person: permission denied
>=20
> I think that isn't because incorrect: username/host/database/password
> because they works in PostgreSQL client PSQL and in pyPgSQL (Python
> adapter). So what's wrong? I'm a quite advanced databases user and i first
> saw acces denied on SELECT after successful connection to the database.
The code seems ok --and it's definitely possible that you get an access
denied after connection to the db; it is just a matter of privileges the
user you're connecting with have. Are you definitely sure that you can
*SELECT* w/ this user with 'psql' command-line or raw pypgsql python
conn.?
The error you get comes from libpq, that's why I'm quite confident in
that this is the database itself that rejects the SELECT for that user
(BTW the user is logged when connecting to the db w/
MDL_ENABLE_DATABASE_LOGGING set to true)
Oh, now I think I remember how this might have happen: did you, by any
chance, access the database w/ another user than the one you used to
create it (the owner)? By default, postgresql denies the access to the
db to any user than the owner (except admin users of course).
Try to connect to the db as a db.admin and type:
GRANT ALL ON TABLE PERSON to <your_user_name>;
(same for table ADDRESS) --then things should go fine.
For further informations on pg's privileges, you can refer to
http://www.postgresql.org/docs/7.3/interactive/privileges.html
http://www.postgresql.org/docs/7.3/static/sql-grant.html
> 2.
> I also unite with the voice of Ernesto Revilla (Re: Summary objects and
> Proxy objects, 2003-06-12 16:56) that extension that allows: aggregations
> (sum,min,max...), having's, group by's is ESSENTIAL. Using more advanced
> queries, that uses that features, is inpossible now. So I can't use Model=
ing
> in my application because of it and must use the "pure" pgSQL adapter.
Your voice has been heard. However, this won't happen in the coming
days, for sure. Would a integrated fetchSQL() make you happy in the
meantime?
-- S=E9bastien.
|