Resolved Query Meta Schema With Odbc

aknyazeva

New Member
Is it possible to query Progress meta schema via ODBC? I have a meta schema table called _aud-audit-data that I would like to run a query against. I can query it with the Procedure Editor and DataDigger using a standard query:
Code:
SELECT * from  _aud-audit-data where _user-id='something'
I'm used to being able to query default schema tables through ODBC using the 'pub.' syntax, but using pub._aud-audit-data in the above query doesn't work - I'm guessing this is because I'm trying to access meta schema. I've tried using '_db.' and 'databasename.' in its place, but that hasn't worked. Can I run this query via ODBC, and if so, what do I need to do?
 

TomBascom

Curmudgeon
In general you can certainly use SQL against the meta schema. I don't have an audit-enabled db kicking around in my office at the moment but you probably have to quote the table name:

Code:
SELECT * from  PUB."_aud-audit-data" where _user-id='something'
 

TomBascom

Curmudgeon
BTW, instead of "it doesn't work" sharing an actual error message goes a long ways towards getting your problem resolved.
 

aknyazeva

New Member
I tried quoting the table name as you suggested, but executing the query with the name in quotes gives me this error: [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Syntax error in SQL statement at or about "_user-id=\'something\'" (10713)')

Because the field in my where clause is a character field, I thought the problem might have to do with improper quoting. I tried using both apostrophes and double-quotes around the _user-id, and tried escaping them according to the escaping rules of the test framework I'm using. I also tried using an integer field rather than a character field so that quotes would not be required, but I still got the same error. That makes me think that quoting may not be the issue.
 

TomBascom

Curmudgeon
That message looks strange. Almost like the source query is missing a quote or has mismatched quotes or double-quotes opening a string and a single quote closing it Or embedded quotes.. Cutting and pasting sometimes messes up quotes. Especially if you are on windows and using any "helpful" microsoft products.
 

aknyazeva

New Member
It does. The test framework I'm using is written in Python (Robot Framework, using the pypyodbc library to run queries using ODBC), and backslashes are the Python standard way of escaping characters. Even if I run this through the Python console, the error message is identical, backslashes and all. I've tried every combination of apostrophes and double-quotes and backslashes that I could think of (\', \", ', ", etc) and every combination gives me the same error. Is it time to call it quits and assume that Python's escape mechanism doesn't play well with quoted table names?
 

aknyazeva

New Member
I tried it without \, yes. No matter whether my query has the backslash or not, the error is returned with a backslash.
 

aknyazeva

New Member
I found a workaround - given that Procedure Editor does not require the quotes, I generated a .p file with the query I need within my test, and ran that file through the command line, outputting the results to the file. From there, it's easy enough to compare the generated file. I don't think my test framework will play nice with the quotes, so this is an acceptable solution for me. Thanks for taking the time to help me blunder through it. :)
 
Top