-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 2780 #2785
base: main
Are you sure you want to change the base?
Issue 2780 #2785
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,21 @@ internal class CdpTableResolver : ICdpTableResolver | |
|
||
private readonly HttpClient _httpClient; | ||
|
||
private readonly string _uriPrefix; | ||
[Obsolete] | ||
private readonly string _uriPrefix = null; | ||
|
||
private readonly bool _doubleEncoding; | ||
|
||
public CdpTableResolver(CdpTable tabularTable, HttpClient httpClient, bool doubleEncoding, ConnectorLogger logger = null) | ||
{ | ||
_tabularTable = tabularTable; | ||
_httpClient = httpClient; | ||
_doubleEncoding = doubleEncoding; | ||
|
||
Logger = logger; | ||
} | ||
|
||
[Obsolete] | ||
public CdpTableResolver(CdpTable tabularTable, HttpClient httpClient, string uriPrefix, bool doubleEncoding, ConnectorLogger logger = null) | ||
{ | ||
_tabularTable = tabularTable; | ||
|
@@ -53,7 +64,12 @@ public async Task<ConnectorType> ResolveTableAsync(string tableName, Cancellatio | |
} | ||
|
||
string dataset = _doubleEncoding ? CdpServiceBase.DoubleEncode(_tabularTable.DatasetName) : _tabularTable.DatasetName; | ||
string uri = (_uriPrefix ?? string.Empty) + (UseV2(_uriPrefix) ? "/v2" : string.Empty) + $"/$metadata.json/datasets/{dataset}/tables/{CdpServiceBase.DoubleEncode(tableName)}?api-version=2015-09-01"; | ||
|
||
#pragma warning disable CS0612 // Type or member is obsolete | ||
string prefix = string.IsNullOrEmpty(_uriPrefix) ? string.Empty : (_uriPrefix ?? string.Empty) + (UseV2(_uriPrefix) ? "/v2" : string.Empty); | ||
#pragma warning restore CS0612 // Type or member is obsolete | ||
|
||
string uri = $"{prefix}/$metadata.json/datasets/{dataset}/tables/{CdpServiceBase.DoubleEncode(tableName)}?api-version=2015-09-01"; | ||
|
||
string text = await CdpServiceBase.GetObject(_httpClient, $"Get table metadata", uri, null, cancellationToken, Logger).ConfigureAwait(false); | ||
|
||
|
@@ -92,7 +108,10 @@ public async Task<ConnectorType> ResolveTableAsync(string tableName, Cancellatio | |
// sqlRelationships = GetSqlRelationships(text2); | ||
//} | ||
|
||
var parts = _uriPrefix.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
#pragma warning disable CS0612 // Type or member is obsolete | ||
var parts = string.IsNullOrEmpty(_uriPrefix) ? Array.Empty<string>() : _uriPrefix.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
#pragma warning restore CS0612 // Type or member is obsolete | ||
|
||
string connectorName = (parts.Length > 1) ? parts[1] : string.Empty; | ||
|
||
ConnectorType connectorType = ConnectorFunction.GetCdpTableType(this, connectorName, _tabularTable.TableName, "Schema/Items", FormulaValue.New(text), ConnectorCompatibility.CdpCompatibility, _tabularTable.DatasetName, | ||
|
@@ -103,8 +122,7 @@ public async Task<ConnectorType> ResolveTableAsync(string tableName, Cancellatio | |
return connectorType; | ||
} | ||
|
||
internal static bool IsSql(string uriPrefix) => uriPrefix.Contains("/sql/"); | ||
|
||
[Obsolete] | ||
internal static bool UseV2(string uriPrefix) => uriPrefix.Contains("/sql/") || | ||
uriPrefix.Contains("/zendesk/"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is ultimately used to determine the endpoint, can we remove from here and push higher? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure where you'd put it If we want to absorb the breaking change fully we can jsut delete all these [Obsolete] things |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove and use httpClient? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so
This one is only used for backward compatibility