You forgot import Field: from dal import DAL, Field
El lun., 5 de nov. de 2018 5:25 p. m., Ben Duncan <[email protected]> escribió: > I put together this simple test case to get familiar with DAL (using Pydal) > > Connection stuff works, but I get this message > [postgres@su-postgres-ben-3 mec_layouts]$ ./pydalgetrec.py > postgres://postgres:postgres@localhost:7103/ac03303_live > postgres > Traceback (most recent call last): > File "./pydalgetrec.py", line 20, in <module> > Field('company_number', type='integer'), > NameError: name 'Field' is not defined > > Source is : > > -------------------------------------------------------------------------------------------------------------------- > #!/usr/bin/env python > # -*- coding: utf-8 -*- > # test > ########################################################### > # Something ... > ############################################################ > > > import os, sys, string, copy, time > import getopt > from types import * > > from pydal import DAL > > db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live", > pool_size=10, migrate_enabled=False, fake_migrate_all=True ) > print db._uri > print db._dbname > > db.define_table('company', > Field('company_number', type='integer'), > Field('company_name', type='string', length=255), > Field('address_1', type='string', length=255), > Field('address_2', type='string', length=255), > Field('city', type='string', length=255), > Field('state', type='string', length=20), > Field('zip', type='string', length=10), > Field('country', type='string', length=255), > primarykey=['company_number'], > migrate=False) > > sys.exit(0); > -------------------------------------------------------------------------------------------------------------------- > > > Any ideas on what is going on? > > thanks .. > > > > *Ben Duncan* > DBA / Chief Software Architect > Mississippi State Supreme Court > Electronic Filing Division > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

