Exemplo n.º 1
0
    def describe_de(self, args):
        """
        describe data extension with customer key.

        :param string customer_key: data extension's customer key
        :return: data extension's name array.
        """
        de_target_fields = [
            "Name",
            "CustomerKey",
            "DefaultValue",
            "FieldType",
            "Scale",
            "MaxLength",
            "IsPrimaryKey",
            "IsRequired",
        ]
        deColumn = FuelSDK.ET_DataExtension_Column()
        deColumn.auth_stub = self.client
        deColumn.props = de_target_fields
        deColumn.search_filter = {
            'Property': 'DataExtension.CustomerKey',
            'SimpleOperator': 'equals',
            'Value': args.customer_key
        }
        response = deColumn.get()
        return [
            self.convert_field_to_dict(result, de_target_fields)
            for result in response.results
        ]
Exemplo n.º 2
0
 def _get_col(self, de_name):
     """
     Get all columns for a Data Extension
     """
     dataextensioncol = FuelSDK.ET_DataExtension_Column()
     dataextensioncol.auth_stub = self.sfmc_client
     dataextensioncol.props = ["Name"]
     dataextensioncol.search_filter = {
         'Property': 'DataExtension.CustomerKey',
         'SimpleOperator': 'equals',
         'Value': de_name
     }
     response = dataextensioncol.get()
     return [i['Name'] for i in response.results]