[web2py] Re: Load data from sqlite file?

2012-05-17 Thread Dave
Yes, that's exactly what i need to do.  I was going to try it like you 
described using the filename to create a new DAL, and defining it as an 
import function somewhere in the model, so glad to hear that it should be 
doable!  Will post my code once i have I get around to writing it.

Thanks,
Dave 

On Friday, 11 May 2012 16:22:57 UTC-6, Brian M wrote:
>
> So the user is going to be uploading a .sqlite file which you want to 
> connect to with the DAL and import? 
>
> You should be able to create a new DAL connection within a controller 
> function or probably better yet a module instead of in a model file (which 
> would have been run too early in the request process). So save the uploaded 
> .sqlite file then find out the filename that web2py gave it and then pass 
> that filename (and path) to a new dal connection, proceed to define the 
> tables as usual and import away.
>
> On Thursday, May 10, 2012 6:38:41 PM UTC-5, Dave wrote:
>>
>> Any examples or suggestions on how to load data from a user-uploaded 
>> .sqlite database?
>>
>> I will have the database structure of the uploaded files ahead of time 
>> (they are being generated by a mobile app), so I need a way to transfer the 
>> data from an uploaded .sqlite file to my web2py tables.  is it possible to 
>> just use the uploaded file as a new dal, then transfer the data to the main 
>> dal, all within a function?
>>
>> Thanks in advance,
>> Dave
>>
>

[web2py] Re: Load data from sqlite file?

2012-05-11 Thread Brian M
So the user is going to be uploading a .sqlite file which you want to 
connect to with the DAL and import? 

You should be able to create a new DAL connection within a controller 
function or probably better yet a module instead of in a model file (which 
would have been run too early in the request process). So save the uploaded 
.sqlite file then find out the filename that web2py gave it and then pass 
that filename (and path) to a new dal connection, proceed to define the 
tables as usual and import away.

On Thursday, May 10, 2012 6:38:41 PM UTC-5, Dave wrote:
>
> Any examples or suggestions on how to load data from a user-uploaded 
> .sqlite database?
>
> I will have the database structure of the uploaded files ahead of time 
> (they are being generated by a mobile app), so I need a way to transfer the 
> data from an uploaded .sqlite file to my web2py tables.  is it possible to 
> just use the uploaded file as a new dal, then transfer the data to the main 
> dal, all within a function?
>
> Thanks in advance,
> Dave
>


[web2py] Re: Load data from sqlite file?

2012-05-11 Thread simon
http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-keyed-tables
 

On Friday, 11 May 2012 00:38:41 UTC+1, Dave wrote:
>
> Any examples or suggestions on how to load data from a user-uploaded 
> .sqlite database?
>
> I will have the database structure of the uploaded files ahead of time 
> (they are being generated by a mobile app), so I need a way to transfer the 
> data from an uploaded .sqlite file to my web2py tables.  is it possible to 
> just use the uploaded file as a new dal, then transfer the data to the main 
> dal, all within a function?
>
> Thanks in advance,
> Dave
>