Yes I did. I forgot to add. The extract_sqlite_models.py didn't work as 
expect. And that may be because I am not doing it right. Thats why I didn't 
mention.


>>>python extract_sqlite_models.py 
C:\Users\...\applications\my_application_name\databases\storage.sqlite

Which generates the following output.

# -*- coding: utf-8 -*-
legacy_db = 
DAL('sqlite://C:/Users/.../applications/my_application_name/databases/storage.sqlite')

legacy_db.define_table('auth_user',
    migrate=False)

#--------
legacy_db.define_table('auth_group',
    migrate=False)

#--------
legacy_db.define_table('auth_membership',
    migrate=False)

#--------
legacy_db.define_table('auth_permission',
    migrate=False)

#--------
legacy_db.define_table('auth_event',
    migrate=False)

#--------
legacy_db.define_table('auth_cas',
    migrate=False)

#--------
legacy_db.define_table('topic',
    migrate=False)

#--------
legacy_db.define_table('comment',
    migrate=False)


But these generates empty fields and may be its due to the new version 
(2.10.3) I am not sure. Probably have to open a ticket. Unless I am doing 
something wrong in calling that function.



On Monday, April 20, 2015 at 10:27:17 AM UTC-4, Richard wrote:
>
>
> https://github.com/web2py/web2py/blob/master/scripts/extract_sqlite_models.py
>
> Have you check gluon/scripts/ before ask?
>
> Richard
>
> On Sun, Apr 19, 2015 at 5:07 PM, Ron Chatterjee <achatte...@gmail.com 
> <javascript:>> wrote:
>
>> 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+un...@googlegroups.com <javascript:>.
>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to