SQL Constructs¶
-
pg_grant.sql.grant(privileges, type: pg_grant.types.PgObjectType, target, grantee, grant_option=False, schema=None, arg_types=None, quote_subname=True)[source]¶ GRANT statement that may be executed by SQLAlchemy.
Parameters: - privileges – List of privileges (or
'ALL'). - type – PostgreSQL object type.
- target – Object name, or appropriate SQLAlchemy object (e.g.
Tableor a declarative class). - grantee – Role to receive privileges.
- grant_option – Whether the recipient may in turn grant these privileges to others.
- schema – Optional schema, if target is a string.
- arg_types – Sequence of argument types for granting privileges on
functions. E.g.
('int4', 'int4')or(). - quote_subname – Quote subname identifier in privileges, e.g.
'SELECT (user)'->'SELECT ("user"). This should only beFalseif the subname is already a valid identifier.
- privileges – List of privileges (or
-
pg_grant.sql.revoke(privileges, type: pg_grant.types.PgObjectType, target, grantee, grant_option=False, schema=None, arg_types=None, quote_subname=True)[source]¶ REVOKE statement that may be executed by SQLAlchemy.
Parameters: - privileges – List of privileges (or
'ALL'). - type – PostgreSQL object type.
- target – Object name, or appropriate SQLAlchemy object (e.g.
Tableor a declarative class). - grantee – Role to lose privileges.
- grant_option – Whether to revoke the grant option for these privileges.
- schema – Optional schema, if target is a string.
- arg_types – Sequence of argument types for revoking privileges on
functions. E.g.
('int4', 'int4')or(). - quote_subname – Quote subname identifier in privileges, e.g.
'SELECT (user)'->'SELECT ("user"). This should only beFalseif the subname is already a valid identifier.
Warning
When
grant_option=True, only the grant option is revoked, not the privilege(s).- privileges – List of privileges (or