Question

I have a connection with :

url = urlparse.urlparse(os.environ["DATABASE_URL"])
self.conn = psycopg2.connect(
            database=url.path[1:],
            user=url.username,
            password=url.password,
            host=url.hostname,
            port=url.port
        )

When I run the query to insert self.cursor.execute("INSERT INTO Divers (email, hashpass) VALUES (%s, %s);",[email, password]) it returns successfully.

However, when I check my data the registration isn't there. When I run this query through the CLI it inserts but the incremented id is increased as if values had been inserted. Pleas help.

Était-ce utile?

La solution

The documentation shows a commit() method commit. So you probably want to try using it like this:

self.conn.commit()
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top