I've been working on this for a while now off and on and have, I believe, 
fixed the web2py gluon code bugs to correct this problem. I filed my fix 
here - https://github.com/web2py/web2py/issues/2483 
<http://GitHub%20web2py%20issues>

On Wednesday, January 17, 2024 at 3:28:37 PM UTC-8 jimka...@yahoo.com wrote:

Sorry, 

for "*Having cleared out the tables before step 3, this results"*  this 
should have said step 4

for "since there is no row in mediatitles that mediatitles_archive..."  this 
should have said there is no row in mediatitles with the required id 

On Wednesday, January 17, 2024 at 12:59:59 PM UTC-8 jimka...@yahoo.com 
wrote:

Hi,

*I believe (using python 3.11.7, web2py 2,24,1, mysql 8), **with web2py 
record versioning enabled, * *I have verified that *

          *db.export_to_csv_file does not write table rows that have the 
"is_active" field set*
*         to False.*

*A simple test case is *
    1. add a new (is_active=True) row to a table (e.g. mediatitles), 
        This results in an "is_active = True" row in mediatitles, 
    2.  Delete (archive) it.
          This results in an "is_active = False" row in mediatitles, 
          and creation of an "is_active = True" row in table 
mediatitles_archive

    3. Now, backup the db (db.export...)
    4. restore it (db.import_from_csv_file)

*Having cleared out the tables before step 3, this results in an empty 
mediatitles table and  a mediatitles_archive table with one row*

which, during execution, causes a MYSQL exception:

"(1452, 'Cannot add or update a child row: 
a foreign key constraint fails (`mfm_curr_lib`.`mediatitles_archive`, 
CONSTRAINT `mediatitles_archive_ibfk_1` FOREIGN KEY (`current_record`) 
REFERENCES `mediatitles` (`id`) ON DELETE CASCADE)') 

since there is no row in mediatitles that mediatitles_archive can reference.

Am I doing something wrong?
Is this fixed in a later web2py version?

Thanks



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/79a9d0e6-5b42-4788-b3e4-a078ea210d2an%40googlegroups.com.

Reply via email to