uesleilima commented on code in PR #2366:
URL: https://github.com/apache/age/pull/2366#discussion_r3041585887
##########
drivers/python/README.md:
##########
@@ -89,9 +89,26 @@ SET search_path = ag_catalog, "$user", public;
* Make sure to give your non-superuser db account proper permissions to the
graph schemas and corresponding objects
* Make sure to initiate the Apache Age python driver with the
```load_from_plugins``` parameter. This parameter tries to
load the Apache Age extension from the PostgreSQL plugins directory located
at ```$libdir/plugins/age```. Example:
- ```python.
+ ```python
ag = age.connect(host='localhost', port=5432, user='dbuser',
password='strong_password',
- dbname=postgres, load_from_plugins=True, graph='graph_name)
+ dbname='postgres', load_from_plugins=True,
graph='graph_name')
+ ```
+
+### Managed PostgreSQL Usage (Azure, AWS RDS, etc.)
+* On managed PostgreSQL services where the AGE extension is loaded server-side
via ```shared_preload_libraries```,
+ the ```LOAD 'age'``` command may fail because the binary is not at the
expected file path. Use the ```skip_load```
+ parameter to skip the ```LOAD``` statement while still performing all other
setup:
+ ```python
+ ag = age.connect(host='myserver.postgres.database.azure.com', port=5432,
+ user='dbuser', password='strong_password',
+ dbname='postgres', skip_load=True, graph='graph_name')
+ ```
+* **Connection pools:** If you manage connections externally (e.g. via
```psycopg_pool.ConnectionPool```),
+ use ```configure_connection()``` instead, which skips ```LOAD 'age'``` by
default and is designed for
+ per-connection setup callbacks:
+ ```python
+ from age import configure_connection
+ configure_connection(conn, graph_name='graph_name')
Review Comment:
Fixed — removed the `configure_connection()` reference since it's not part
of this branch. The README now shows `setUpAge(conn, 'graph_name',
skip_load=True)` for the connection pool example.
##########
drivers/python/age/age.py:
##########
@@ -333,9 +341,9 @@ def __init__(self):
# Connect to PostgreSQL Server and establish session and type extension
environment.
def connect(self, graph:str=None, dsn:str=None, connection_factory=None,
cursor_factory=ClientCursor,
- load_from_plugins:bool=False, **kwargs):
+ load_from_plugins:bool=False, skip_load:bool=False, **kwargs):
Review Comment:
`connection_factory` is a pre-existing parameter in the codebase (not
introduced by this PR). Addressing it would be scope creep — happy to open a
separate issue if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]