pythonpostgresqlponyorm

Create postgres database from pony ORM


Is it possible to create a new database from pony ORM? We couldn't find it within pony ORM docs, it's always assumed the database exists or is using SQLite file.

We would like to create a testing database and drop it afterwards.


Solution

  • No. Per:

    https://docs.ponyorm.org/api_reference.html#sqlite

    Supported databases

    If you look at the .bind() API for the various databases, SQLite is the only one with create_db. This is because in SQLite creating a database is just creating a single file. The other engines need to go through their own program to initialize a database. You will need to create an independent script that creates the database.