Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Dataframe/Dataset from Query

avatar
New Member

Hi ,

I have one query which contain many join. Now I want to create a Dataframe or Dataset from the query (not from a single table) in scala

1 ACCEPTED SOLUTION

avatar
Guru

@Thangarajan Pannerselvam,

1) Python:

You can actually use panda to get a data frame from a query result. Read below blog for details on how to run a query on a database and get data frame from a result.

https://www.dataquest.io/blog/python-pandas-databases/

2) Scala:

You can also use jdbc driver to run a query and save the result of query in data frame. ( use spark.read.jdbc api).

Details can be found in below link.

https://sparkour.urizone.net/recipes/using-jdbc/

View solution in original post

2 REPLIES 2

avatar
Guru

@Thangarajan Pannerselvam,

1) Python:

You can actually use panda to get a data frame from a query result. Read below blog for details on how to run a query on a database and get data frame from a result.

https://www.dataquest.io/blog/python-pandas-databases/

2) Scala:

You can also use jdbc driver to run a query and save the result of query in data frame. ( use spark.read.jdbc api).

Details can be found in below link.

https://sparkour.urizone.net/recipes/using-jdbc/

avatar
New Member

Great Working Fine now