Then the define_table is restricted to the "context" that they are within ? .. And not to the global object ( db connection )
Em sexta-feira, 6 de janeiro de 2017 10:03:00 UTC-3, Anthony escreveu: > > > On Friday, January 6, 2017 at 6:49:15 AM UTC-5, Marlysson Silva wrote: >> >> You can use the variable_db_conection.define_table(...) into your >> controller , using the data received from form submitted .. >> >> def create_table(): >> >> data = some_request_data_object >> >> variable_db.define_table(data['table_name'], >> Field(data['field_name'],'type'), >> Field(data['field_name_2'],'type_2') >> ) >> >> I think that so works.. >> > > That will indeed define the table, but it can then only be used from > within that specific function, as that is the only place the table is > defined (it will not exist on subsequent requests to other > functions/controllers). > > Anthony > >> >> Em sexta-feira, 6 de janeiro de 2017 01:18:46 UTC-3, Leonardo Dutra >> escreveu: >>> >>> Hi guys, >>> I need to create a table in my db from a controller, such as: >>> I have my controller and after to submit a form it will create a new >>> table automatically, it's possible? >>> If they have better suggestions, please feel free to tell me! >>> >>> Thanks a lot! >>> >> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.