Skip to content

Commit

Permalink
refactor session sql
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Nov 21, 2024
1 parent 7f68da6 commit 5b73da1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/scala/com/snowflake/snowpark/Session.scala
Original file line number Diff line number Diff line change
Expand Up @@ -945,11 +945,24 @@ class Session private (private[snowpark] val conn: ServerConnection) extends Log
* You can use this method to execute an arbitrary SQL statement.
*
* @param query The SQL statement to execute.
* @param params for bind variables in SQL statement.
* @return A [[DataFrame]]
* @since 0.1.0
*/
def sql(query: String, params: Seq[Any] = Seq.empty): DataFrame = {
def sql(query: String): DataFrame = {
sql(query, Seq.empty)
}

/**
* Returns a new DataFrame representing the results of a SQL query.
*
* You can use this method to execute an arbitrary SQL statement.
*
* @param query The SQL statement to execute.
* @param params for bind variables in SQL statement.
* @return A [[DataFrame]]
* @since 1.15.0
*/
def sql(query: String, params: Seq[Any]): DataFrame = {
// PUT and GET command cannot be executed in async mode
DataFrame(this, plans.query(query, None, !Utils.isPutOrGetCommand(query), params))
}
Expand Down

0 comments on commit 5b73da1

Please sign in to comment.