Psycopg 2 #3204
-
|
Add Psycopg 2 to flet |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
|
So, how (why?) are we supposed to access PostgreSQL on/from a mobile device? What's the use case here? |
Beta Was this translation helpful? Give feedback.
-
|
This is generally not a good idea to access a database from clients device. Databases cant handle concurrent connections like a web server can. So i am -1 on this |
Beta Was this translation helpful? Give feedback.
-
|
For interacting with postgres off a mobile phone
…On Sat, May 4, 2024 at 10:41 PM Feodor Fitsner ***@***.***> wrote:
So, how (why?) are we supposed to access PostgreSQL on/from a mobile
device? What's the use case here?
—
Reply to this email directly, view it on GitHub
<#3204 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXYIYQEMZN4KGRBMHVPYEUTZAVBXDAVCNFSM6AAAAABHG7HONSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGMJWGE2TG>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
psycopg2 is now available for iOS and Android: https://pypi.flet.dev/psycopg2 Just add it to your dependencies and # pyproject.toml
dependencies = [
"flet",
"psycopg2",
]Note: It's a client — it connects to a remote PostgreSQL server over the network; there's no embedded database on the phone. TLS and SCRAM-SHA-256 auth work out of the box (libpq + OpenSSL are bundled into the wheel). Example with a real import psycopg2
conn = psycopg2.connect(
host="your-db-host", port=5432, dbname="mydb", user="me", password="secret"
)
with conn.cursor() as cur:
cur.execute("SELECT version()")
print(cur.fetchone())
conn.close()Give it a try and let know how. |
Beta Was this translation helpful? Give feedback.
psycopg2 is now available for iOS and Android: https://pypi.flet.dev/psycopg2
Just add it to your dependencies and
flet buildpulls the right iOS/Android wheels automatically:Note: It's a client — it connects to a remote PostgreSQL server over the network; there's no embedded database on the phone. TLS and SCRAM-SHA-256 auth work out of the box (libpq + OpenSSL are bundled into the wheel).
Example with a real
connect()+ query round-trip against PostgreSQL 17: