Learn how to turn code-behind into assemblies to be used and reused in Data Lake Analytics jobs.
U-SQL makes it easy to add your own custom code in .Net languages, such as C#, VB.Net or F#. You can even deploy your own runtime to support other languages.
The easiest way to use custom code is to use the Data Lake Tools for Visual Studio’s code-behind capabilities. For more information, see Tutorial: develop U-SQL scripts using Data Lake Tools for Visual Studio. There are a few drawbacks of using code-behind:
- The source code gets uploaded for every script submission.
- code-behind cannot be shared with other jobs.
To address these drawbacks, you can turn code-behind into assemblies, and register the assemblies to the Data Lake Analytics catalog.
Prerequisites
- Visual Studio 2017, Visual Studio 2015, Visual Studio 2013 update 4, or Visual Studio 2012 with Visual C++ Installed
- Microsoft Azure SDK for .NET version 2.5 or above. Install it using the Web platform installer or Visual Studio Installer
- A Data Lake Analytics account. See Get Started with Azure Data Lake Analytics using Azure portal.
- Go through the Get started with Azure Data Lake Analytics U-SQL Studio tutorial.
- Connect to Azure.
- Upload the source data, see Get started with Azure Data Lake Analytics U-SQL Studio.
Develop assemblies for U-SQL
To create and submit a U-SQL job
- From the File menu, click New, and then click Project.
- Expand Installed, Templates, Azure Data Lake, U-SQL(ADLA), select the Class Library (For U-SQL Application) template, and then click OK.
Write your code in Class1.cs. The following is a code sample.
using Microsoft.Analytics.Interfaces; namespace USQLApplication_codebehind { [SqlUserDefinedProcessor] public class MyProcessor : IProcessor { public override IRow Process(IRow input, IUpdatableRow output) { output.Set(0, input.Get<string>(0)); output.Set(0, input.Get<string>(0)); return output.AsReadOnly(); } } }- Click the Build menu, and then click Build Solution to create the dll.
Register assemblies
See Use Data Lake Analytics(U-SQL) catalog.
Use the assemblies
See Use the Azure Data Lake Tools for Visual Studio Code.

