0

I am trying to get the data from RDS database using aws glue service. I know using connection we can get the solution. But I wanted to know is there any way to access our RDS-database in glue-script directly.

I tried with below code but it is not working :

==============================================

    from pyspark.context import SparkContext 
    from awsglue.context import GlueContext

    sc = SparkContext()
    glueContext = GlueContext(sc)
    spark= glueContext.spark_session


    url="jdbc:postgresql://<RDS Domain Name>:<port>/database"

    properties={
        "user":"postgres",
        "password":"some_password"
    }

    df= spark.read.jdbc(url=url, table="table_name",properties=properties)
    
    job.commit()

0 Answers0