Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AI Tutor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Salma Mohammed Hamed
AI Tutor
Commits
2d14ec4a
Commit
2d14ec4a
authored
Sep 11, 2025
by
SalmaMohammedHamedMustafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handeling database from inside voice agent container
parent
78f5ff19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
docker-compose.yml
self_hosted_env/docker-compose.yml
+5
-0
requirements.txt
self_hosted_env/voice_agent/requirements.txt
+1
-0
test_db.py
self_hosted_env/voice_agent/test_db.py
+48
-0
No files found.
self_hosted_env/docker-compose.yml
View file @
2d14ec4a
...
@@ -73,6 +73,11 @@ services:
...
@@ -73,6 +73,11 @@ services:
N8N_WEBHOOK_URL
:
"
${N8N_WEBHOOK_URL}"
N8N_WEBHOOK_URL
:
"
${N8N_WEBHOOK_URL}"
OPENAI_API_KEY
:
"
${OPENAI_API_KEY}"
OPENAI_API_KEY
:
"
${OPENAI_API_KEY}"
MINIO_BUCKET
:
"
${MINIO_BUCKET}"
MINIO_BUCKET
:
"
${MINIO_BUCKET}"
POSTGRES_HOST
:
"
postgres"
POSTGRES_USER
:
"
${POSTGRES_USER}"
POSTGRES_PASSWORD
:
"
${POSTGRES_PASSWORD}"
POSTGRES_DB
:
"
${POSTGRES_DB}"
volumes
:
volumes
:
-
./uploads:/app/uploads
-
./uploads:/app/uploads
depends_on
:
depends_on
:
...
...
self_hosted_env/voice_agent/requirements.txt
View file @
2d14ec4a
...
@@ -6,3 +6,4 @@ fastapi
...
@@ -6,3 +6,4 @@ fastapi
uvicorn[standard]
uvicorn[standard]
python-multipart
python-multipart
openai
openai
psycopg2-binary
\ No newline at end of file
self_hosted_env/voice_agent/test_db.py
0 → 100644
View file @
2d14ec4a
import
os
import
psycopg2
from
psycopg2.extras
import
RealDictCursor
# Read credentials from environment variables
POSTGRES_HOST
=
os
.
getenv
(
"POSTGRES_HOST"
,
"postgres"
)
POSTGRES_USER
=
os
.
getenv
(
"POSTGRES_USER"
)
POSTGRES_PASSWORD
=
os
.
getenv
(
"POSTGRES_PASSWORD"
)
POSTGRES_DB
=
os
.
getenv
(
"POSTGRES_DB"
)
def
get_db_connection
():
conn
=
psycopg2
.
connect
(
host
=
POSTGRES_HOST
,
user
=
POSTGRES_USER
,
password
=
POSTGRES_PASSWORD
,
dbname
=
POSTGRES_DB
)
return
conn
# Example usage
if
__name__
==
"__main__"
:
conn
=
get_db_connection
()
cur
=
conn
.
cursor
(
cursor_factory
=
RealDictCursor
)
# Get all table names in the public schema
cur
.
execute
(
"""
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
"""
)
tables
=
cur
.
fetchall
()
for
table
in
tables
:
table_name
=
table
[
'table_name'
]
print
(
f
"Contents of table: {table_name}"
)
# Fetch all rows in the table
cur
.
execute
(
f
"SELECT * FROM {table_name};"
)
rows
=
cur
.
fetchall
()
for
row
in
rows
:
print
(
row
)
print
(
"
\n
"
)
cur
.
close
()
conn
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment