<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Materialized Views with Scala in Data &amp; Schema Discussions</title>
    <link>https://community.incorta.com/t5/data-schema-discussions/materialized-views-with-scala/m-p/5441#M446</link>
    <description>&lt;P&gt;I am trying to refactor some tables that were previously using pyspark to use scala.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However whenever I try to read in my data I am met with an error that states "table or view not found"&lt;/P&gt;&lt;P&gt;My code looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import org.apache.spark.sql.{SparkSession, DataFrame}

// Define your schema
val schema = "schema_name"
val table = "table_name"

// Read the table into a DataFrame
val df: DataFrame = spark.read
.format("parquet") // table format
.option("header", "true") // Add options as needed
.option("inferSchema", "true")
// .schema(schema) // Specify the schema here
.table(s"$schema.$table")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to troubleshoot if I need to switch directories or anything I tried running&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Show all schemas in the current database
spark.sql("SHOW DATABASES").show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which tells me that I am in a database named "default"&lt;/P&gt;&lt;P&gt;Running the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Show all tables in the current database
spark.sql("SHOW TABLES").show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns an empty dataframe with 3 columns named database, tableName, and isTemporary.&lt;/P&gt;&lt;P&gt;All 3 fields are blank&lt;/P&gt;&lt;P&gt;How can I go about connecting scala to the correct schema?&lt;/P&gt;</description>
    <pubDate>Sun, 28 Jan 2024 22:55:38 GMT</pubDate>
    <dc:creator>mkrieger</dc:creator>
    <dc:date>2024-01-28T22:55:38Z</dc:date>
    <item>
      <title>Materialized Views with Scala</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/materialized-views-with-scala/m-p/5441#M446</link>
      <description>&lt;P&gt;I am trying to refactor some tables that were previously using pyspark to use scala.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However whenever I try to read in my data I am met with an error that states "table or view not found"&lt;/P&gt;&lt;P&gt;My code looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import org.apache.spark.sql.{SparkSession, DataFrame}

// Define your schema
val schema = "schema_name"
val table = "table_name"

// Read the table into a DataFrame
val df: DataFrame = spark.read
.format("parquet") // table format
.option("header", "true") // Add options as needed
.option("inferSchema", "true")
// .schema(schema) // Specify the schema here
.table(s"$schema.$table")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to troubleshoot if I need to switch directories or anything I tried running&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Show all schemas in the current database
spark.sql("SHOW DATABASES").show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which tells me that I am in a database named "default"&lt;/P&gt;&lt;P&gt;Running the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Show all tables in the current database
spark.sql("SHOW TABLES").show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns an empty dataframe with 3 columns named database, tableName, and isTemporary.&lt;/P&gt;&lt;P&gt;All 3 fields are blank&lt;/P&gt;&lt;P&gt;How can I go about connecting scala to the correct schema?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jan 2024 22:55:38 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/materialized-views-with-scala/m-p/5441#M446</guid>
      <dc:creator>mkrieger</dc:creator>
      <dc:date>2024-01-28T22:55:38Z</dc:date>
    </item>
  </channel>
</rss>

