Hi, 

Here is my code.


*postgres_db = DAL("postgres://postgres@localhost:5432/" + 
get_postgres_db_filename(), auto_import=True, pool_size=10, 
migrate_enabled=False, fake_migrate_all=True)*

"get_postgres_db_filename()" will get you 
"CaptureOutput-2019-11-15_03-25-19-MN"



I have defined the table

        postgres_db.define_table('vmhive',
                                 Field('id', type='uuid'),
                                 Field('owner', type='uuid'),
                                 Field('fsid', type='bigint'),
                                 Field('demuxer', type='uuid'),
                                 Field('origin_hive', type='uuid'),
                                 Field('name', type='citext'),
                                 Field('replicaset', type='text'),
                                 Field('visible', type='boolean'),
                                 Field('creation_time', type='bigint'),
                                 Field('platform_tag', type='text'),
                                 Field('platform_name', type='text'),
                                 Field('backup_policy', type='uuid'),
                                 Field('deletion_time', type='bigint'),
                                 Field('ancestor', type='uuid'),
                                 Field('removed_time', type='bigint'),
                                 Field('tree_id', type='uuid'),
                                 Field('owner_number', type='bigint'),
                                 Field('ready_for_backup', type='boolean'),
                                 Field('hive_version', type='bigint'),
                                 Field('hms_platform_id', type='text'),
                                 Field('stat', type='text'),
                                 Field('hms_host_id', type='text'),
                                 Field('ft_enabled', 'boolean'),
                                 Field('ft_primary', type='boolean'),
                                 Field('power_state', type='text'),
                                 Field('rb_ignore', type='boolean'))



When I explicitly issue SQL statements.
I am able to get result.

*print(postgres_db.executesql('SELECT * FROM vmhive where deletion_time > 
0;'))*

[('*9f750dab-48e3-4a98-a62c-41e38b6b1ce1*', 
'42147e2a-826a-f2a2-0130-7580c4cfad5f', 2874592791, 
'4a5a47b8-4eb6-4d28-9b65-9a88a3f0727d', 
'00000000-0000-0000-0000-000000000000', 'Oracle-test_172_16_0_201', 
'2|36:4214534b-83c5-1feb-150d-a632928dd77c|36:42147e2a-826a-f2a2-0130-7580c4cfad5f|'
, True, 1573183778, '', 'Oracle-test_172_16_15_200', 
'f67c4112-0b70-4309-9b15-83387fa316dd', 1573187250, 
'd4985d85-d508-4565-bf7a-e125de44a4e5', 0, 
'42bb9964-7026-4af2-849b-592858a899dd', 2, True, 1, 
'51bd75d3-ab1c-4782-b73c-81f0605c2881:VirtualMachine:vm-153', 
'1;0;0;16741;1;0;0;0;0;0;0;1573183778;1573183778;1573183778', '', False, 
False, '3', False)]


But when I try the following
*        for row in postgres_db(postgres_db.vmhive.deletion_time > 
0).select():*
*            print(row.name)*

ValueError: invalid literal for int() with base 10: 
'9f750dab-48e3-4a98-a62c-41e38b6b1ce1'



But when I check the Field type and length

*        print(postgres_db.vmhive.id.type)*
*        print(postgres_db.vmhive.id.length)*

id
512


Other Fields are fine

*        print(postgres_db.vmhive.owner.type)*
*        print(postgres_db.vmhive.fsid.type)*
*        print(postgres_db.vmhive.name.type)*
*        print(postgres_db.vmhive.hms_host_id.type)*
*        print(postgres_db.vmhive.rb_ignore.type)*

uuid
bigint
citext
text
boolean


Now this is a pre-populated database, so I cant change anything on it.
I am wondering how to force "id" Field to not behave like a int Field ?

Thanks in Advance.


-- 
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/2d89e80c-57aa-474b-b09d-397fc5279e0b%40googlegroups.com.

Reply via email to