fork(1) download
  1. import sys
  2. from awsglue.transforms import *
  3. from awsglue.utils import getResolvedOptions
  4. from pyspark.context import SparkContext
  5. from awsglue.context import GlueContext
  6. from awsglue.job import Job
  7. glueContext = GlueContext(sc)
  8. spark = glueContext.spark_session
  9. job = Job(glueContext)
  10. datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "apps_community_olap_stg", table_name = "fe_glueapps_community_olap_stg_fe_adm_city_vm", transformation_ctx = "datasource0")
  11.  
  12. datasource1 = glueContext.create_dynamic_frame.from_catalog(database = "apps_community_olap_stg", table_name = "fe_glueapps_community_olap_stg_fe_adm_state_vm")
  13. datasource1 = datasource1.drop_field(['state_code', 'state_name', 'active', 'client', 'legislation']).rename_field('id', 'state_id').rename_field('country','country_id')
  14.  
  15. l_result= Join.apply(datasource0, datasource1, 'state_code', 'state_code').drop_field(['city_code','country_code','state-code','client', 'legislation'])
  16. l_result.printSchema()
Runtime error #stdin #stdout #stderr 0.08s 64792KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 2, in <module>
    from awsglue.transforms import *
ImportError: No module named awsglue