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 that I am choosing not to expose here";
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
}
});
}
}
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
@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.
Regarding line 8, Is mySnowFlakeQuery a variable? If so, it needs to be in curly braces. (Just checking)
Regarding line 8, Is mySnowFlakeQuery a variable? If so, it needs to be in curly braces. (Just checking)
var query1 = $"mySnowFlakeQuery";
Hi Uma, I just used $"mySnowFlakeQuery" as a substitution for the actual query that I am using. I didn't want to expose my actual query to the public but it's a valid sql query. Also, I've been working with someone in tech support and they let me know that they re-produced this issue and think that it might be a bug.