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") }
- Alphabetic
- By Inheritance
- MagpieContext
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
about: MagpieInfo
Return information about the current Magpie session.
Return information about the current Magpie session.
- returns
Magpie info
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exec(command: String): Any
Execute a single command and return the result.
-
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:
- Unit
- String (JSON)
- com.silectis.magpie.runtime.MagpieRows
mc.execute("save result as table people")
- command
command string to execute
- returns
command result
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
-
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
-
val
secrets: SecretContext
SecretContext with methods for interacting with Magpie Secrets
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
val
variables: VariableContext
VariableContext with methods for interacting with Magpie Variables
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()