3
$\begingroup$

I've been able to connect to a Vertica database, and also been able to run a SELECT query. But I'm not being able to run a query with a backslash in it. (Vertica has commands like postgresql.) The command I'm trying to run is \d;. I've tried variations like below with a varying number of backslashes without success:

SQLExecute[conn, "\\\d;"]

What am I doing wrong? Any help would be greatly appreciated!

Edit: I should add that the error I'm getting is this: JDBC::error: [Vertica][VJDBC](4856) ERROR: Syntax error at or near "\" >>

$\endgroup$
2
  • 2
    $\begingroup$ Three backslashes cannot be correct. Mathematica requires that each one be escaped, once, as \\. If Vertica requires an additional escape, you will have to enter four backslashes for each one you want to appear in the query. Beyond that, I have no suggestions, since I've never used this software--sorry. $\endgroup$ Mar 27 '13 at 8:49
  • $\begingroup$ @OleksandrR. What is the Vertica connection string? It's native into Mathematica? $\endgroup$
    – Murta
    Oct 22 '14 at 18:26
1
$\begingroup$

This is more a workaround than an answer. Schema information for all tables is also available in a table. In the case of vertica, a query like the following would get all schemas:

columns={"table_schema","table_name","column_name","data_type","data_type_length","is_nullable","column_default"};
SQLExecute[conn,"SELECT "<>StringJoin[Riffle[columns, ", "]]<>" FROM v_catalog.columns"];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.