-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue during postprovision : #20
Comments
I modified setup_postres_azurerole.py to the following and it fixed that error: current_dir = os.path.abspath(os.path.dirname(file)) print("Current sys.path:", sys.path) from dotenv import load_dotenv logger = logging.getLogger("legalcaseapp") async def create_ag_catalog_schema(engine): async def assign_role_for_webapp(engine, app_identity_name): async def main(): if name == "main": |
I created a fork here that deploys successfully, you might have to modify the py scripts to use "python" on your machine, my machine uses "py" https://github.com/mazer-rakham/graphrag-legalcases-postgres/tree/thomas-flock-suggestions |
Hello Team,
I've well deployed the semantic reranker first, copy the .env, updated the below variable :
Then, after a few errors on the setup_postgres_legal_database.py (because of the path), I'm facing an issue during post deployment step :
PS C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres> azd up
? Environment 'postgresql-graph' does not exist, would you like to create it? (Y/n)
ERROR: loading environment: prompting to create environment 'postgresql-graph': interrupt
? Environment 'pgsql-graph' does not exist, would you like to create it? Yes
? Select an Azure Subscription to use: 37. xxxxxxxxxxxxxxxxxxxxxx)
? Select an Azure location to use: 31. (Europe) Sweden Central (swedencentral)
Packaging services (azd package)
(✓) Done: Packaging service web
Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time.
Subscription: MCAPS-Hybrid-REQ-55446-2023-aantonelli (0bf9ccf7-89ed-455b-8c5a-97c0a85fa27e)
Location: Sweden Central
You can view detailed progress in the Azure Portal:
https://portal.azure.com/#view/HubsExtension/DeploymentDetailsBlade/~/overview/id/%2Fsubscriptions%2Fxxxxxxxx%2Fproviders%2FMicrosoft.Resources%2Fdeployments%2Fpgsql-graph-1734628119
(✓) Done: Resource group: pgsql-graph-rg (3.689s)
(✓) Done: Log Analytics workspace: pgsql-graph-di3wracltt6ge-loganalytics (2.796s)
(✓) Done: Application Insights: pgsql-graph-di3wracltt6ge-appinsights (5.758s)
(✓) Done: Azure OpenAI: pgsql-graph-di3wracltt6ge-openai (28.369s)
(✓) Done: Portal dashboard: pgsql-graph-di3wracltt6ge-appinsights-dashboard (1.467s)
(✓) Done: Azure AI Services Model Deployment: pgsql-graph-di3wracltt6ge-openai/gpt-35-turbo-16k (1.077s)
(✓) Done: Azure AI Services Model Deployment: pgsql-graph-di3wracltt6ge-openai/text-embedding-3-small (2.155s)
(✓) Done: Container Registry: pgsqlgraphdi3wracltt6geregistry (22.216s)
(✓) Done: Container Apps Environment: pgsql-graph-di3wracltt6ge-containerapps-env (35.882s)
(✓) Done: Azure Database for PostgreSQL flexible server: pgsql-graph-di3wracltt6ge-postgresql (4m10.669s)
(✓) Done: Container App: pgsql-graph-di3wrac-ca (30.76s)
current sys.path: ['C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app', 'C:\Python311\python311.zip', 'C:\Python311\DLLs', 'C:\Python311\Lib', 'C:\Python311', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32\lib', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\Pythonwin', 'C:\Python311\Lib\site-packages', 'C:\Users\aantonelli\source\repos\autogen_v04\autogen\python\packages\autogen-magentic-one\src', 'C:\Python311\Lib\site-packages\vboxapi-1.0-py3.11.egg', 'C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend']
content of backend_dir: ['.dockerignore', 'Dockerfile', 'entrypoint.sh', 'fastapi_app', 'package-lock.json', 'pyproject.toml', 'static']
INFO:legalcaseapp:Enabling azure_ai extension...
INFO:legalcaseapp:Enabling the pgvector extension for Postgres...
INFO:legalcaseapp:Setting Azure ML endpoint and API key...
INFO:legalcaseapp:Creating semantic_relevance function...
INFO:legalcaseapp:Creating database tables and indexes...
INFO:legalcaseapp:Enabling the Apache AGE extension for Postgres...
INFO:legalcaseapp:Database extension and tables created successfully.
current sys.path: ['C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app', 'C:\Python311\python311.zip', 'C:\Python311\DLLs', 'C:\Python311\Lib', 'C:\Python311', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32\lib', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\Pythonwin', 'C:\Python311\Lib\site-packages', 'C:\Users\aantonelli\source\repos\autogen_v04\autogen\python\packages\autogen-magentic-one\src', 'C:\Python311\Lib\site-packages\vboxapi-1.0-py3.11.egg', 'C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend']
content of backend_dir: ['.dockerignore', 'Dockerfile', 'entrypoint.sh', 'fastapi_app', 'package-lock.json', 'pyproject.toml', 'static']
INFO:ragapp:Authenticating to Azure Database for PostgreSQL using Azure Identity...
INFO:ragapp:Updating password token for Azure Database for PostgreSQL
INFO:ragapp:Creating a PostgreSQL role for identity pgsql-graph-di3wracltt6ge-id-web
INFO:ragapp:Granting permissions to pgsql-graph-di3wracltt6ge-id-web
INFO:ragapp:Role created successfully.
current sys.path: ['C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app', 'C:\Python311\python311.zip', 'C:\Python311\DLLs', 'C:\Python311\Lib', 'C:\Python311', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\win32\lib', 'C:\Users\aantonelli\AppData\Roaming\Python\Python311\site-packages\Pythonwin', 'C:\Python311\Lib\site-packages', 'C:\Users\aantonelli\source\repos\autogen_v04\autogen\python\packages\autogen-magentic-one\src', 'C:\Python311\Lib\site-packages\vboxapi-1.0-py3.11.egg', 'C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend']
content of backend_dir: ['.dockerignore', 'Dockerfile', 'entrypoint.sh', 'fastapi_app', 'package-lock.json', 'pyproject.toml', 'static']
INFO:ragapp:Authenticating to Azure Database for PostgreSQL using Azure Identity...
INFO:azure.identity._internal.decorators:AzureDeveloperCliCredential.get_token succeeded
INFO:legalcaseapp:Starting data seeding from C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\data\cases_final.csv using parameterized INSERT statements.
INFO:ragapp:Updating password token for Azure Database for PostgreSQL
INFO:azure.identity._internal.decorators:AzureDeveloperCliCredential.get_token succeeded
INFO:legalcaseapp:gold_dataset table initialized successfully.
INFO:legalcaseapp:100 rows inserted and committed in batch.
INFO:legalcaseapp:100 rows inserted and committed in batch.
INFO:legalcaseapp:100 rows inserted and committed in batch.
INFO:legalcaseapp:100 rows inserted and committed in batch.
INFO:legalcaseapp:10 rows inserted and committed in batch.
INFO:legalcaseapp:Data seeding completed successfully.
INFO:legalcaseapp:Function get_vector_semantic_graphrag_optimized defined successfully.
INFO:legalcaseapp:Function initialize_age_extension defined successfully.
INFO:legalcaseapp:Function create_case_in_case_graph defined successfully.
INFO:legalcaseapp:Function create_case_link_in_case_graph defined successfully.
INFO:legalcaseapp:case_graph database is created successfully.
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 546, in _prepare_and_execute
self._rows = await prepared_stmt.fetch(*parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\asyncpg\prepared_stmt.py", line 176, in fetch
data = await self.__bind_execute(args, 0, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\asyncpg\prepared_stmt.py", line 267, in __bind_execute
data, status, _ = await self.__do_execute(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\asyncpg\prepared_stmt.py", line 256, in __do_execute
return await executor(protocol)
^^^^^^^^^^^^^^^^^^^^^^^^
File "asyncpg\protocol\protocol.pyx", line 206, in bind_execute
asyncpg.exceptions.UndefinedObjectError: role "None" does not exist
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\default.py", line 922, in do_execute
cursor.execute(statement, parameters)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 580, in execute
self.adapt_connection.await(
File "C:\Python311\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 130, in await_only
return current.driver.switch(awaitable) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 195, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 558, in _prepare_and_execute
self._handle_exception(error)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 509, in _handle_exception
self._adapt_connection._handle_exception(error)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 797, in _handle_exception
raise translated_error from error
sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.ProgrammingError: <class 'asyncpg.exceptions.UndefinedObjectError'>: role "None" does not exist
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app\setup_postgres_legal_seeddata.py", line 537, in
asyncio.run(main())
File "C:\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app\setup_postgres_legal_seeddata.py", line 528, in main
await seed_data_from_csv(engine, args.app_identity_name)
File "C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app\setup_postgres_legal_seeddata.py", line 114, in seed_data_from_csv
await ingest_cases_to_graph_from_postgresql(session, app_identity_name)
File "C:\Users\aantonelli\source\repos\graphrag-legalcases-postgres\src\backend\fastapi_app\setup_postgres_legal_seeddata.py", line 178, in ingest_cases_to_graph_from_postgresql
await session.execute(text(f'GRANT ALL ON SCHEMA case_graph TO "{app_identity_name}";'))
File "C:\Python311\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 455, in execute
result = await greenlet_spawn(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 200, in greenlet_spawn
result = context.throw(*sys.exc_info())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\orm\session.py", line 2308, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\orm\session.py", line 2199, in _execute_internal
result = conn.execute(
^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1416, in execute
return meth(
^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\sql\elements.py", line 517, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1848, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 2344, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "C:\Python311\Lib\site-packages\sqlalchemy\engine\default.py", line 922, in do_execute
cursor.execute(statement, parameters)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 580, in execute
self.adapt_connection.await(
File "C:\Python311\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 130, in await_only
return current.driver.switch(awaitable) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 195, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 558, in _prepare_and_execute
self._handle_exception(error)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 509, in _handle_exception
self._adapt_connection._handle_exception(error)
File "C:\Python311\Lib\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 797, in _handle_exception
raise translated_error from error
sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedObjectError'>: role "None" does not exist
[SQL: GRANT ALL ON SCHEMA case_graph TO "None";]
(Background on this error at: https://sqlalche.me/e/20/f405)
ERROR: error executing step command 'provision': failed running post hooks: 'postprovision' hook failed with exit code: '1', Path: 'C:\Users\AANTON~1\AppData\Local\Temp\azd-postprovision-2881539855.ps1'. : exit code: 1
any idea on how to solve ?
thanks in advance,
Alex
The text was updated successfully, but these errors were encountered: