glue-neptune/glue_neptune/GremlinCsvTransforms.py [30:62]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @classmethod
    def create_prefixed_columns(cls, datasource, mappings):
        """Creates columns in a DynamicFrame whose values are based on prefixed values from another column in the DynamicFrame.
        
        Example:
        >>> df = GremlinCsvTransforms.create_prefixed_columns(df, [('~id', 'productId', 'p'),('~to', 'supplierId', 's')])
        """
        dataframe = datasource.toDF()
        for (column_name, source_column, prefix) in mappings:
            dataframe = dataframe.withColumn(column_name, format_string(prefix + "-%s", dataframe[source_column]))
        return DynamicFrame.fromDF(dataframe, datasource.glue_ctx, 'create_vertex_id_columns')
    
    @classmethod
    def create_edge_id_column(cls, datasource, from_column, to_column):
        """Creates an '~id' column in a DynamicFrame whose values are based on the specified from and to columns.
        
        Example:
        >>> df = GremlinCsvTransforms.create_edge_id_column(df, 'supplierId', 'productId')
        """
        dataframe = datasource.toDF()
        dataframe = dataframe.withColumn('~id', format_string("%s-%s", dataframe[from_column], dataframe[to_column]))
        return DynamicFrame.fromDF(dataframe,  datasource.glue_ctx, 'create_edge_id_column')
    
    @classmethod    
    def addLabel(cls, datasource, label):
        """Adds a '~label' column to a DynamicFrame whose values comprise the supplier label.
        
        Example:
        >>> df = GremlinCsvTransforms.addLabel(df, 'Product')
        """
        dataframe = datasource.toDF()
        dataframe = dataframe.withColumn("~label", lit(label))
        return DynamicFrame.fromDF(dataframe, datasource.glue_ctx, label)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



neptune-python-utils/neptune_python_utils/glue_gremlin_csv_transforms.py [21:53]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @classmethod
    def create_prefixed_columns(cls, datasource, mappings):
        """Creates columns in a DynamicFrame whose values are based on prefixed values from another column in the DynamicFrame.
        
        Example:
        >>> df = GlueGremlinCsvTransforms.create_prefixed_columns(df, [('~id', 'productId', 'p'),('~to', 'supplierId', 's')])
        """
        dataframe = datasource.toDF()
        for (column_name, source_column, prefix) in mappings:
            dataframe = dataframe.withColumn(column_name, format_string(prefix + "-%s", dataframe[source_column]))
        return DynamicFrame.fromDF(dataframe, datasource.glue_ctx, 'create_vertex_id_columns')
    
    @classmethod
    def create_edge_id_column(cls, datasource, from_column, to_column):
        """Creates an '~id' column in a DynamicFrame whose values are based on the specified from and to columns.
        
        Example:
        >>> df = GlueGremlinCsvTransforms.create_edge_id_column(df, 'supplierId', 'productId')
        """
        dataframe = datasource.toDF()
        dataframe = dataframe.withColumn('~id', format_string("%s-%s", dataframe[from_column], dataframe[to_column]))
        return DynamicFrame.fromDF(dataframe,  datasource.glue_ctx, 'create_edge_id_column')
    
    @classmethod    
    def addLabel(cls, datasource, label):
        """Adds a '~label' column to a DynamicFrame.
        
        Example:
        >>> df = GlueGremlinCsvTransforms.addLabel(df, 'Product')
        """
        dataframe = datasource.toDF()
        dataframe = dataframe.withColumn("~label", lit(label))
        return DynamicFrame.fromDF(dataframe, datasource.glue_ctx, label)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



