Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Dataframe/Dataset from Query

avatar
Contributor

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
Contributor

Great Working Fine now