How to check if table exists in vertica DataBase using Robot Framework/Python

750 views
Skip to first unread message

Madhu

unread,
Jun 10, 2017, 12:40:30 AM6/10/17
to robotframework-users


I am trying to check whether table-name exists in database and it is throwing me that schema doesn't exist.I have to verify set of tables after data mining.I have tried to get the values from table and it is successful.Following is the code that I am trying.

***Settings*** 
    Library  DatabaseLibrary
    Library  Collections

    ***Testcases***
    Connect to Vertica and Check if table exist
      Connect To Database Using Custom Params       vertica_python  database='pmdb',user='dbadmin', password='warehouse', host='10.166.12.242', port=5433
      Table Must Exist     DCA_ITOC_RESOURCE_D   
      #${tableName}   Query   select table_name from tables where table_schema='OBR' AND table_name='RESOURCE_D'
      #List Should Contain Value   ${tableName}   RESOURCE_D
Test result

root@hyi01lr0bsaehost92:/var/robot-tests# pybot database-tests.robot 
==============================================================================
Database-Tests                                                                
==============================================================================
Connect to Vertica and Check if table exist                           | FAIL |
MissingSchema: Severity: ERROR, Message: Schema "information_schema" does not exist, Sqlstate: 3F000, Routine: RangeVarGetObjid, File: /scratch_a/release/svrtar1291/vbuild/vertica/Catalog/Namespace.cpp, Line: 288, SQL: u"SELECT * FROM information_schema.tables WHERE table_name='RESOURCE_D'"
------------------------------------------------------------------------------
Database-Tests                                                        | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /var/robot-tests/output.xml
Log:     /var/robot-tests/log.html
Report:  /var/robot-tests/report.html
Reply all
Reply to author
Forward
0 new messages