[web2py] How to define constraints DAL Beginner

2020-07-21 Thread Ivan Luis
db.define_table('jogador', Field('nome', 'string'), Field('posicao','string'), Field('altura','double'), Field('peso','double'), Field('equipe') ) db.define_table('equipe', Field('nome', 'string') ) I'm trying do reference the field " Equipe " at Jogador with "Name" at Equipe but

[web2py] Multiple sockets

2020-07-21 Thread xgp.l...@gmail.com
Hi, Is there a way to specify socket name for DB connection? Actually is only possible to specify directory, but i have multiple sockets on a postgres 11 cluster setup. Ex: Cluster 1 postgres2://postgres:postgrespass@/dbname?unix_socket=/tmp/.s.PGSQL.5432 Cluster 2

[web2py] [pydal] Connect to Heroku Database

2020-07-21 Thread Carlos Zenteno
Has anybody been able to connect to a Postgres database using stand alone Pydal? I know I have to pass the database credentials via the environment variable DATABASE_URL thru the heroku-cli like this: DATABASE_URL=$(heroku config:get DATABASE_URL -a books-proyecto1) MY-PROCESS but I don't know

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread mostwanted
Impressive outlook Villas, thank you. On Tuesday, July 21, 2020 at 12:16:29 PM UTC+2, villas wrote: > > Your my_validator function iterates through the whole table. This is OK > when you have a few records, but very inefficient if you have > thousands/millions. Why not simply query the

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread villas
Your my_validator function iterates through the whole table. This is OK when you have a few records, but very inefficient if you have thousands/millions. Why not simply query the table? Something like this... def my_validator(form): if db((db.lecture.id == form.vars.id) &