databricks-sql-cli icon indicating copy to clipboard operation
databricks-sql-cli copied to clipboard

Support for Parameter Markers

Open jkoppelm opened this issue 1 year ago • 1 comments

It doesn't look like databricks-sql-cli supports passing parameter markers, though the Databricks CLI supports them (example here).

Would you consider adding?

jkoppelm avatar Dec 16 '24 00:12 jkoppelm

sqlexecute.py:131 calls databricks.cursor.execute(query)

The cursor.execute method (databricks/sql/client.py:453) signature accepts an optional parameter dictionary:

    def execute(
        self, operation: str, parameters: Optional[Dict[str, str]] = None
    ) -> "Cursor":

It would be great if there were some way to create the dictionary from the command line (string, json, or a reference to a file with key,value pairs). My preference would be:

python -m dbsqlcli.main -e "SELECT col1 + :o1, col2 + :o2 FROM my_table" -params "o1=1;o2=2"

jkoppelm avatar Dec 16 '24 01:12 jkoppelm