Hmm, looks like that should work automatically if you're using the Heroku 
contrib module to connect to your db. Are you doing:

from gluon.contrib.heroku import get_db
db = get_db(name=None, pool_size=10)

Anthony


On Tuesday, September 1, 2015 at 11:48:27 PM UTC-4, James McGlynn wrote:
>
> Thanks for the response!
>
> I was able to find documentation on how web2py stores metadata in *.table 
> files. So I understand what you are saying about them, and I agree that 
> turning off migrations when running remotely would get rid of the error. 
>
> But my question was about how/when web2py decides it needs to create the 
> "web2py_filesystem" table for storing metadata without a filesystem and 
> how/when it decides to look for metadata in that table, rather than the 
> file system. 
>
> I found this answer 
> <https://groups.google.com/d/msg/web2py/TLlMMBYchGQ/SIdLQOPLTOYJ> from 
> Massimo on another thread:
>
> web2py stores metadata about DB tables which have been created. This is 
>> necessary for migrations. Normally this metadata is store in *.table files. 
>> Heroku has a strange filesystem that gets wiped up at random times. For 
>> this reason the *.table files are not in the "normal filesystem". Web2py 
>> creates a filesystem in database in a table called "web2py_filesystem" and 
>> stores the *.table files in there.
>
>
> So I just would like to understand how this happens. Is there a place in 
> the source I could start reading that handles this?
>
> Thank you.
>
>
> On Monday, August 31, 2015 at 9:48:59 PM UTC-4, Anthony wrote:
>>
>> The *.table files include metadata about the tables for use with the 
>> migrations functionality. If the *.table file is missing and migrations are 
>> turned on, web2py will assume the associated table needs to be created 
>> (resulting in an error if it already exists). Probably you simply want to 
>> turn off migrations in the production environment.
>>
>> Anthony
>>
>> On Monday, August 31, 2015 at 9:00:38 PM UTC-4, James McGlynn wrote:
>>>
>>>
>>> class 'psycopg2.ProgrammingError' relation "my_table" already exists
>>>
>>> I have configured my app so that I can set a flag to use either a local 
>>> sqlite db, or a remote Heroku db when running locally, but when running 
>>> remotely on Heroku, the Heroku db is always used. The databases do not 
>>> contain the same data, nor do I need/want them to. 
>>>
>>> I have come across this error a few times now for different reasons. I'm 
>>> pretty comfortable with resolving it at this point, but one way I 
>>> consistently get the error is by creating a new table while developing 
>>> locally with sqlite and then pushing my changes to Heroku, without first 
>>> running locally with the postgresql db.
>>>
>>> Can someone explain why my app seems to need a .table file for the new 
>>> table to be pushed to heroku, even though it gets eventually removed by 
>>> Heroku anyway? Does the logic for the storing metadata in the db use the 
>>> .table files in the filesystem to create the metadata stored in the db the 
>>> first time it senses that its running on Heroku or something?
>>>
>>> How would this work on a platform like elasticbeanstalk, which doesn't 
>>> offer the luxury of having the files on the file system temporarily 
>>> available after a push. 
>>>
>>

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