Just wanted to share code  for execution of data project through code. Similar logic is used  during bank statement import . If you would like to explore more look at the standard class  BankStatementImportBatch.   Prerequisite  is you must have data project created. I am going to show  simple example of  creating a customer group , I  created a data  project called CustGroupTest

This can be useful in integration scenarios where you  can get file stream  from another application . In the below code I am  generating stream and writing customer Group Id and name to it.  Once I get the stream I am uploading it to blob as a csv file and getting fileID. This fileID  is used for  further  execution. Execution is done by DMFQuickImportExport::doPGImport() method.

public static void main(Args _args)
    {  
        ExecutePermission           permission;
        DMFDefinitionGroupEntity    definitionGroupEntity;
        DMFEntity                   dmfEntity;
        FileUploadTemporaryStorageResult result;
        private const str importEntityName = 'CustCustomerGroupEntity';
        
        #File

        System.IO.StreamWriter sw;
        System.IO.StreamReader sr;
        System.IO.MemoryStream   fileStream;
      
           
        fileStream = new System.IO.MemoryStream();

        sw = new System.IO.StreamWriter(fileStream);

        sw.WriteLine("CUSTOMERGROUPID,DESCRIPTION");

        sw.WriteLine(strFmt("%1,%2",'TestGroup','Test customer group'));
       
        sw.Flush();

        SysDictClass uploadStrategyDictClass = new SysDictClass(className2Id('FileUploadTemporaryStorageStrategy'));
        FileUploadTemporaryStorageStrategy fileUploadStrategy = uploadStrategyDictClass.makeObject() as FileUploadTemporaryStorageStrategy;

        Debug::assert(fileUploadStrategy != null);

        result = fileUploadStrategy.uploadFile(fileStream, 'custGroup.csv');


        SharedServiceUnitFileID  SharedServiceUnitFileID;
        
       
        SharedServiceUnitFileID = result.getFileId();
                
        fileStream.Dispose();

        CodeAccessPermission::revertAssert();

        DMFExecutionId executionId = DMFUtil::setupNewExecution('CustGroupTest');

        select firstonly RecId, Entity from definitionGroupEntity exists join dmfEntity
            where definitionGroupEntity.DefinitionGroup == 'CustGroupTest' &&
                dmfEntity.EntityName == definitionGroupEntity.Entity &&
            dmfEntity.TargetEntity == importEntityName ;

        // Find execution
        DMFDefinitionGroupExecution execution =
                DMFDefinitionGroupExecution::find(
                    'CustGroupTest', definitionGroupEntity.Entity, executionId, true);
        execution.IsTransformed = NoYes::No;
        execution.FilePath = SharedServiceUnitFileID;
        execution.IsTransformed = NoYes::Yes;
        execution.update();

        DMFQuickImportExport::doPGImport('CustGroupTest', executionId, true);
    }

 

After running this runnable job  customer group is created  and you can see  all the history  in your data project.