I have sqlite browser. I am guessing its the same like SQlite Manager where 
someone can import, export csv or sql file. I don't have password in that 
database and work externally to the python 

*I guess one possibility will be:*

import MySQLdb

import sys

try:

db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db = 
'my_dabasename')

except Exception as e:

sys.exit('we cant get into the db');

 cursor = db.cursor()

cursor.execute('SELECT *FROM table')

results = cursor.fetchall()

print results


Once the table is fetched then use the insert_into_table option to create 
db object.


Just saying...




On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>
> And what would be the utility since you already have INSERT INTO TABLE... 
> Someone can just use something like SQLite Manager (
> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to import 
> it... Once in SQLite DB (which anyway it should) he can use web2py csv 
> export import if he want to migrate from SQLite to Postgres for instance...
>
> Richard
>
> On Tue, Apr 21, 2015 at 3:55 PM, Niphlod <nip...@gmail.com <javascript:>> 
> wrote:
>
>>
>>
>> On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:
>>>
>>> I tried this:
>>>
>>> db = 
>>> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False, 
>>> pool_size=20)
>>>
>>> It didn't work either. I guess someone needs to look at how to connect 
>>> to legacy database. 
>>>
>>>
>> where is the password ?!
>>
>> BTW: I think there's a bit of misunderstandings going on in this thread. 
>> There are two separate concept at play: schema (structure) AND data.
>> Every script/extract_***_models.py can "inspect" an existing database and 
>> figure out (with limitations) the model you should write to access that 
>> database --> schema (or structure) translated to nifty 
>> "db.define_table(....)"
>>
>> Exporting and importing a csv (compatible with what web2py generates) 
>> instead - again, with limitations - is the way to transfer data around.
>>
>> If you have a long list of SQL statements in a file, those are NOT going 
>> to work. 
>> There's virtually nothing that reverse-engineers table definitions such 
>> as "CREATE TABLE ....." to a model file, nor something that turns "INSERT 
>> INTO TABLE..." to a db.table.insert(), although it can be fun to create one 
>> (with lots of headaches).
>>
>>  -- 
>> 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