I have the following SQL file:

BEGIN TRANSACTION;
CREATE TABLE topic(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    title CHAR(512) NOT NULL,
    is_active CHAR(1),
    created_on TIMESTAMP,
    created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
    modified_on TIMESTAMP,
    modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
);
INSERT INTO `topic` VALUES(1,'regergerg','T','2015-04-14 
14:32:52',1,'2015-04-14 14:32:52',1);
INSERT INTO `topic` VALUES(2,'egergerger','T','2015-04-14 
14:33:27',1,'2015-04-14 14:33:27',1);


Is there a script that will convert this to db.py in other words, spit out 
the following code?

db.define_table('topic',
    Field('title', label=T('Title'), notnull=True, requires=IS_NOT_EMPTY()),
    auth.signature,    
    format='%(title)s',
)

I asked because if I have a large SQL file then creating the table by hand 
or looking at the schema may take some time. Wondering if there is a script 
in the script folder that automoatically does this conversion. I know 
"extract_mysql_models.py" in the script folder but that only take an 
existing mysql file and does the conversion. I am not sure if it does SQL 
to DAL directly. Am I correct? 

-- 
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.

Reply via email to