#Flask and PostgreSQL on vercel

4 messages · Page 1 of 1 (latest)

odd hatch
#

Hey, I have a question regarding vercel
I am trying to deploy a flask app with a postgres db, I found out that vercel had a built-in postgresql endpoint, so I switched my db's credentials to vercel's, currently I'm trying to call this function to create the table

def create_table():
    with conn.cursor() as cursor:
        cursor.execute(
            """
            CREATE TABLE IF NOT EXISTS users (
                id SERIAL PRIMARY KEY,
                date TIMESTAMP NOT NULL,
                name TEXT NOT NULL
            )
            """
        )
        conn.commit()
``` but I have no idea where to call it, because vercel has its own runtime, I have tried putting it in the bottom of the file but it didn't work and the table didn't get created and I tried using this decorator from flask `@app.before_first_request` but it didn't work as well and I get this error everytime I go to a route `Unknown application error occurred Runtime.Unknown`, any help?
#

I can ofc create the table manually but im not cringe like that

alpine plover
#

this is neither a flask, nor a postgresql, nor a vercel server, so your question is off-topic here. i'll keep it here since some people may come by and answer it if they know, but you will have more luck asking this in a vercel community, e.g. https://github.com/orgs/vercel/discussions

odd hatch