Xi12
Xi12

Reputation: 1223

How to specify multiplte schema in snowflake,pyspark connections

I have connections details as below and I need to read 2 tables from different schema (Employees and HR),

sfparams = {
  "sfURL" : "123.com",
  "sfUser" : "a",
  "sfPassword" : "b",
  "sfDatabase" : "Test",
  "sfSchema" : "Employee",
  "sfWarehouse" : "PD1"
}

How do I read data from HR schema?

Upvotes: 0

Views: 131

Answers (1)

Lukasz Szozda
Lukasz Szozda

Reputation: 175826

To read data from different schema two part names should be provided, i.e., schema_name.table_name:

df = spark.read.format(SNOWFLAKE_SOURCE_NAME) \
  .options(**sfparams) \
  .option("query",  "select * from HR.table1") \
  .load()

Upvotes: 1

Related Questions