fake_migrate=True is not working

142 views
Skip to first unread message

Andrea Fae'

unread,
Aug 24, 2020, 5:18:32 AM8/24/20
to web2py-users
Hello, if I chose migrate= False and fake_migrate=True the .tables in databases folder are not created.
Why?
I'm attaching appconfig.ini and py.db and my custom db db_asset.py
Thank you
appconfig.ini
db.py
db_asset.py

Clemens

unread,
Aug 24, 2020, 6:39:47 AM8/24/20
to web2py-users
Hi,

I'm not very deep in your issue. But opening your appconfig.ini with my default editor shows that the apostrophe in your authors value could be a problem:

Untitled.jpg

Thus, just delete it and have try. If it doesn't change anything, please let me know and I will have a closer look.

Best regards
Clemens

Andrea Fae'

unread,
Aug 26, 2020, 2:32:13 AM8/26/20
to web2py-users
Hello, thank you for your answer.
I deleted the character but nothing changes.
Best regards 
Andrea

Jim S

unread,
Aug 26, 2020, 8:46:05 AM8/26/20
to web2py-users
Did you remove the apostrophe at the bottom as well?

I haven't used migrate / fake migrate in the past the way that you are implementing.

Are you intentionally trying to set it by table?

For me, on my DAL statement I'd include:
migrate_enabled=myconf.get('db.migrate')
fake_migrate_all
=myconf.get('db.fake_migrate_all')

then in appconfig.ini I'd have:
[db]
uri
= mssql4://sa/Web2PyPassword@TS-SQL2016R2/itassetdb
migrate
= True
fake_migrate_all
= True



Can you try that and see if it helps?

Also, I'd remove all the migrate stuff from auth and all the individual tables.  I just set it globally, but that may be a personal preference kind of thing.

-Jim

Andrea Fae'

unread,
Aug 26, 2020, 11:14:03 AM8/26/20
to web2py-users
Thank you for your suggestions...Like this (see attaached files)?
but, no way, no .tables created...I don't know why...
db.py
db_asset.py
appconfig.ini

Jim Steil

unread,
Aug 26, 2020, 11:32:09 AM8/26/20
to web...@googlegroups.com
You still have migrate set to False in your appconfig.ini.

-Jim

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/PLIV6cNvRnc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e1702e2a-1c5f-4d0b-a27b-67cece00d923o%40googlegroups.com.

Andrea Fae'

unread,
Aug 27, 2020, 3:30:39 AM8/27/20
to web2py-users
thank you Jim, but I don't understand...

If I set 
migrate=False
fake_migrate= True

it means that web2py create the .table files without touching the db, isn'it?

If I set
migrate=True
fake_migrate=True

It means what exactly?

thank you so much
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.

Clemens

unread,
Aug 27, 2020, 4:51:21 AM8/27/20
to web2py-users
Hi,

one more distance try: What does your sql.log file say? It's also to be found in the databases folder. For example, I can find there entries like:
timestamp: 2020-08-21T17:53:29.984015
CREATE TABLE "functionality_attributes"(
    "id" SERIAL PRIMARY KEY,
    ...
);
success!

I had a similar problem about 2 years ago. I can't remember exactly the problem/solution. But the reason was, that I've tried to switch the uri to another database and therefore the .table files were already existing. That confuses the system since the tables were already processed in the (old) .table files but didn't exist in the (new) database. It's important for the .table files that different databases have different "file IDs" (db['_uri_hash']) since these are used for .table file naming.

Well then:
  • What about your sql.log?
  • Do your have direct access to the database (w/o web2py) using this user/password account? (sorry for that question, but sometimes it's that easy :-)
  • Are there any .table files already in your database folder?
Since it's fresh new database I would set fake_migrate to false and migrate to true.

Best regards,
Clemens

Andrea Fae'

unread,
Aug 27, 2020, 10:51:32 AM8/27/20
to web2py-users
Hello Clemens, here you are the answers:

  • What about your sql.log? I don't have in the databases folder. I tried with different combinations of migrate and fake_migrate_all but no way
  • Do your have direct access to the database (w/o web2py) using this user/password account? (sorry for that question, but sometimes it's that easy :-) YES
  • Are there any .table files already in your database folder? Yes all tables are now in the databases folder
My application is now fully functional, I could change one table in the db_asset.py because maybe with migrate=true and fake_migrate_all=True it generates the sql.log. What do you think?
Thank you

Jose C

unread,
Aug 28, 2020, 6:08:25 AM8/28/20
to web...@googlegroups.com
thank you Jim, but I don't understand...

If I set 
migrate=False
fake_migrate= True

it means that web2py create the .table files without touching the db, isn'it?

If I set
migrate=True
fake_migrate=True

It means what exactly?

migrate=True tells web2py to do the table migration procedure (i.e. make any changes to your db based on your models and update the .table control files) .  
fake_migrate=True tells web2py to *not* actually create/modify the tables in the db itself but to just create the .table files (without any db action at all).

If migrate=False then web2py does nothing, regardless of the fake_migrate setting.


HTH,
 

Andrea Fae'

unread,
Aug 31, 2020, 7:02:46 AM8/31/20
to web2py-users
Now I understand. thank you so much
Reply all
Reply to author
Forward
0 new messages