Select to view content in your preferred language

Snowflake query layer won't copy to local geodatabase

107
2
Tuesday
MK13
by
New Contributor III

I am attempting to copy a snowflake query layer to a local geodatabase but the GP tool fails with no error messages or any messages for that matter. What could be the issue? I have confirmed that the snowflake table gets created as I return the count of rows found.

 

var pgs = Project.Current.GetItems<GDBProjectItem>();
foreach (var pg in pgs)
{
	if (pg.Name == "SnowflakeProd.sde")
	{
		var mlyr = "mylyr";
		var serviceEventTablename = "MySnowflakeTable";
		var query1 = $"mySnowFlakeQuery";
		await QueuedTask.Run(async () =>
		{
			using (var snowflakeSde = pg.GetDatastore() as Database)
			{
				var k = snowflakeSde.GetQueryDescription(query1, mlyr);
				k.SetObjectIDFields(realUid);
				var outTable = snowflakeSde.OpenTable(k) as Table;
				var outTablePath = @"C:\Users\MyuserId\Documents\ArcGIS\Projects\MyProject5\MyProject5.gdb\TTCopySnflk";
				var outpath = @"C:\Users\MyUserId\Documents\ArcGIS\Projects\MyProject5\MyProject5.gdb";
				var outname = "TTCopySnflk";

				var count = outTable.GetCount();
				MessageBox.Show($"{count}");
				var copyParams = Geoprocessing.MakeValueArray(outTable.GetPath().AbsolutePath, outTablePath);
				var env = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
				var copyResult = await Geoprocessing.ExecuteToolAsync("conversion.ExportTable", copyParams, env);//, null, GPExecuteToolFlags.Default); can't get this to work
				if (copyResult.IsFailed)
				{
					throw new Exception($"{String.Join(',', copyResult.ErrorMessages)}, {String.Join(',', copyResult.Messages)}");
				}
				//copyResult fails with empty error messages 
			}

		});
	}
}

 

 @NarelleChedzey @UmaHarano @Wolf @CharlesMacleod 

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

"conversion.ExportTable" geoprocessing tool has 3 mandatory parameters. One is missed in your parameters list (use_field_alias_as_name). I would recommend to call ExecuteToolAsync with GP events processing (callback) as in thread. In OnValidate event you will get information about wrong parameters and etc.

More info here

0 Kudos
MK13
by
New Contributor III

@GKmieliauskas That was helpful, thank you. I was able to retrieve the error message as below:

 

C:/Users/myuserid/AppData/Local/Temp/ArcGISProTemp49672/562bf87bd4889d4e2094a30b9462ccc7.sde/EDW.ODS.%25mylyrCsharp1 does not exist or is not supported</msg>}

 

What I am now wondering is why the snowflake query layer/table that was created by the line below

var outTable = snowflakeSde.OpenTable(k) as Table;

doesn't exist or is not supported since again, I can get the count of the rows so I know that it exists. 

0 Kudos