[web2py] Incorrect archive/restore behavior?

2024-01-17 Thread 'jimka...@yahoo.com' via web2py-users
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/d5c45c67-949d-4bfe-ae08-a08102ba76bfn%40googlegroups.com.


[web2py] Re: Incorrect archive/restore behavior?

2024-01-17 Thread 'jimka...@yahoo.com' via web2py-users
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/741a0354-97d9-4056-aa77-b579bb6d31c7n%40googlegroups.com.