1

Greetings fellow developers!

Does anyone know if there is there a way to query from dynamic external data source names in U-SQL?

For example, in the MS sample script below, we would like the "MyAzureSQLDWDataSource" to be generated dynamically.

@results =
    SELECT DateTime.Now AS dayTime, * 
    FROM EXTERNAL MyAzureSQLDWDataSource LOCATION "dbo.AdventureWorksDWBuildVersion";

OUTPUT @results
TO "/Output/ReferenceGuide/DDL/DataSources/Query2B.csv"
USING Outputters.Csv(outputHeader: true);

Thanks!

Jake Lee
  • 7,549
  • 8
  • 45
  • 86
Han Gao
  • 11
  • 2

1 Answers1

3

You cant connect to external data source. You can use DataFactory and use a Copy Activity to download your data to DataLake and U-SQL Activity to execute your USQL Script. You can trigger it on demand or schedule it.

https://learn.microsoft.com/en-us/azure/data-factory/concepts-pipelines-activities

Jorge Ribeiro
  • 1,128
  • 7
  • 17
  • Thank you for the response. I already have the external data source set up and every things runs correctly. My question is on if there's a way to dynamically generate the external data source name in the U-SQL script. – Han Gao Jan 10 '19 at 17:05
  • If you use Data Factory you can set parameters that can be passed to U-SQL job. – Jorge Ribeiro Jan 10 '19 at 17:12
  • I am familiar with that. However you can't use string literals for external data source identifiers. That's the problem that I am trying to solve. – Han Gao Jan 11 '19 at 20:01
  • Have you explored the ARM templates yet? – Jorge Ribeiro Jan 14 '19 at 09:52