Passing A Customized Sql 关注

Legacy Poster

Is there any possibility to pass the whole sql statement( from command line) to bartender ?  And bartender needs to set the input string as sql statement. Because my sql is a customized query.

1 评论

Ian Einman
评论操作 固定链接

No, we do not support that.  BarTender needs to know what the schema is for the query at the time you design the database.  Even custom SQL has a "schema" in the sense of a certain number of fields with the field type of each field known.  Allowing the SQL to completely change could result in an entirely different format of results (number, name, and type of fields) coming back to BarTender.  We wouldn't know how to connect the fields to the data.


More likely, you're doing one of the following:


1. Using the same table(s) but significantly changing the WHERE clause

2. Dynamically changing which table the data is coming from (between tables of similar schemas)


#1 can be supported with query prompts, at least with most simpler conditions.  If you have some conditions which don't seem to be supported using our query prompts, please contact tech support so they can file a feature request.


#2 is not supported directly, but you can probably do something like it using a view that combines the tables, and adds a column specifying which table is which.  For example:


SELECT *, 1 AS TableNumber FROM table1
SELECT *, 2 AS TableNumber FROM table2;


Now you have a unified table with a new column that specifies which table the data is from.  Turn that into a view, and then attach BarTender to that view, and a query prompt to the TableNumber field.


This isn't a complete solution, just some ideas that might help you move forward.