Snowpark Scala API Reference1.19.1 < Back


# Packages

-  package root
  Definition Classes
    root
-  package com
  Definition Classes
    root
-  package snowflake
  Definition Classes
    com
-  package snowpark
  Definition Classes
    snowflake
-  class Session extends Logging

  Establishes a connection with a Snowflake database and provides methods for creating DataFrames and accessing objects for working with files in stages.

  Establishes a connection with a Snowflake database and provides methods for creating DataFrames and accessing objects for working with files in stages.

  When you create a `Session` object, you provide configuration settings to establish a connection with a Snowflake database (e.g. the URL for the account, a user name, etc.). You can specify these settings in a configuration file or in a Map that associates configuration setting names with values.

  To create a Session from a file:

      val session = Session.builder.configFile("/path/to/file.properties").create

  To create a Session from a map of configuration properties:

      val configMap = Map(
      "URL" -> "demo.snowflakecomputing.com",
      "USER" -> "testUser",
      "PASSWORD" -> "******",
      "ROLE" -> "myrole",
      "WAREHOUSE" -> "warehouse1",
      "DB" -> "db1",
      "SCHEMA" -> "schema1"
      )
      Session.builder.configs(configMap).create

  Session contains functions to construct DataFrames like Session.table, Session.sql, and Session.read

  Definition Classes
    snowpark
  Since

    0.1.0

- implicits

o

com.snowflake.snowpark.Session

# implicits

###

#### object implicits extends Implicits with Serializable

Provides implicit methods for convert Scala objects to Snowpark DataFrame and Column objects.

To use this, import `session.implicits._` :

    val session = Session.builder.configFile(..).create
    import session.implicits._

After you import this, you can call the `toDF` method of a `Seq` to convert a sequence to a DataFrame:

    // Create a DataFrame from a local sequence of integers.
    val df = (1 to 10).toDF("a")
    val df = Seq((1, "one"), (2, "two")).toDF("a", "b")

You can also refer to columns in DataFrames by using `$"colName"` and `'colName`:

    // Refer to a column in a DataFrame by using $"colName".
    val df = session.table("T").filter($"a" > 1)
    // Refer to columns by using 'colName.
    val df = session.table("T").filter('a > 1)

Since

  0.1.0

Linear Supertypes
Serializable, Implicits, AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. implicits
2. Serializable
3. Implicits
4. AnyRef
5. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Type Members

1.  implicit class ColumnFromString extends AnyRef

   Converts $"col name" into a Column.

   Converts $"col name" into a Column.

   Definition Classes
     Implicits

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  def _session: Session
   Attributes
     protected
   Definition Classes
     implicits → Implicits
5.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
6.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
7.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
8.  def equals(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef → Any
9.  final def getClass(): Class[_ <: AnyRef]
   Definition Classes
     AnyRef → Any
   Annotations
     @HotSpotIntrinsicCandidate() @native()
10.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @HotSpotIntrinsicCandidate() @native()
11.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
12.  implicit def localSeqToDataframe[T](s: Seq[T])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): DataFrame
    Definition Classes
      Implicits
13.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
14.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
15.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @HotSpotIntrinsicCandidate() @native()
16.  implicit def symbolToCol(s: Symbol): Column
    Definition Classes
      Implicits
17.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
18.  def toString(): String
    Definition Classes
      AnyRef → Any
19.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
20.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()
21.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])

### Deprecated Value Members

1.  def finalize(): Unit
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.Throwable]) @Deprecated
   Deprecated

     (Since version 9)

### Inherited from Serializable

### Inherited from Implicits

### Inherited from AnyRef

### Inherited from Any

### Ungrouped