Packages

c

com.silectis.magpie

MagpieContext

final class MagpieContext extends AnyRef

Main entry point for Magpie functionality. The MagpieContext is used to execute commands, run SQL queries, get data frames for Magpie tables, and more.

Available as mc in scala script tasks and scala notebook blocks.

Example usage:

val flavors = Seq("apple", "banana", "strawberry")

flavors.foreach { f =>
  mc.sql(s"select * from store_sales where flavor = '$f'")
  mc.exec(s"save result as table ${f}_sales")
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MagpieContext
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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 about: MagpieInfo

    Return information about the current Magpie session.

    Return information about the current Magpie session.

    returns

    Magpie info

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def exec(command: String): Any

    Execute a single command and return the result.

    Execute a single command and return the result. Alias for execute.

    command

    command string to execute

    returns

    command result

    See also

    execute

  10. def execute(command: String): Any

    Execute a single command and return the result.

    Execute a single command and return the result.

    Commands return one of:

    mc.execute("save result as table people")
    command

    command string to execute

    returns

    command result

  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def getTableDataFrame(table: String): DataFrame

    Get the data frame for a Magpie table, optionally qualified by schema.

    Get the data frame for a Magpie table, optionally qualified by schema.

    val df = mc.getTableDataFrame("people")
    df.show()
    table

    table name

    returns

    table data frame

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def interpret(command: String): Unit

    Execute the provided command and render the result visually

    Execute the provided command and render the result visually

    For example, to render the first 100 rows of the table people:

    mc.interpret("show 100 from people")
    command

    command to execute

  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def profile(df: DataFrame): Unit

    Profile a data frame and render the profile visually

    Profile a data frame and render the profile visually

    mc.profile(df)
    df

    data frame

  21. def result: DataFrame

    Get the last result as a spark data frame

    Get the last result as a spark data frame

    mc.sql("select * from people")
    val people = mc.result.collect()
    returns

    result data frame

  22. val secrets: SecretContext

    SecretContext with methods for interacting with Magpie Secrets

  23. def sql(sql: String): DataFrame

    Execute a SQL command, returning the resulting data frame.

    Execute a SQL command, returning the resulting data frame.

    val df = mc.sql("select distinct name from people")
    sql

    SQL statement

    returns

    data frame result

  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. val variables: VariableContext

    VariableContext with methods for interacting with Magpie Variables

  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped