Skip to content

johannspies/pg_to_web2py_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

pg_to_web2py_model

A script that queries a PostgreSQL database and creates a model file for existing tables Requires at least python3.6 This script expect the following to be in a model where this output will be used:

tsv = SQLCustomType(
    type ='text',
    native='tsvector' )
citext = SQLCustomType(
    type ='text',
    native='citext' )
uuidtype = SQLCustomType(
    type = 'text',
    native = 'uuid'
)
boolean = SQLCustomType(
    type = 'boolean',
    native = 'boolean'
)

It takes into account cases where table names and field names might be reserved words.
In such cases a "c_" will be added to the name and rname will be used.

Typical web2py-auth-related tables like auth_user, auth_group etc. are ignored. And so all id-fields.

This version of the script expect a config file with the name "~/.pg.ini" something like this:

host = localhost
user = thisuser
password = thisuserpassword
port = 5432

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages