Connecting Python to PostgreSQL: A Beginner's Guide with Psycopg & PyCharm

preview_player
Показать описание

Want to leverage the power of Postgres databases in your Python projects? This comprehensive video is your one-stop shop for getting started! You'll learn how to manage your PostgreSQL instance effectively within PyCharm, your Python IDE. Also, you will see how to connect it with your Python code using the popular psycopg library.

#postgresql #pydantic #crud #psycopg #tutorial #python #pythonprogramming #pycharm
Рекомендации по теме
Комментарии
Автор

your code is working but i have to pass some optional parameters while making the connection and also I have to make some changes in my query as per my table schema.

conn_info = make_conninfo(
host="localhost", port=5432, user="postgres",
dbname="fastapi_db", password="admin"
)


create_post = """
INSERT INTO public.posts (title, content) VALUES (%s, %s)
RETURNING id
"""

get_post = """
SELECT * FROM public.posts WHERE id = %s
"""

farazahmed
Автор

I am just curious what is the difference in using ORM vs Pyscopg?

farazahmed
welcome to shbcf.ru