以编程方式将文件从Azure Blob存储传输到Google云端存储(Transfer file from Azure Blob Storage to Google Cloud Storage programmatically)
我有许多文件通过Azure数据工厂传输到Azure Blob存储中。 不幸的是,这个工具似乎没有为任何值设置Content-MD5值,所以当我从Blob存储API中提取该值时,它是空的。
我打算将这些文件从Azure Blob存储转移到Google存储中。 我在Google的Storagetransfer服务上看到的文档位于https://cloud.google.com/storage/transfer/reference/rest/v1/TransferSpec#HttpData,表示如果我提供的列表,我可以轻松启动此类转移。文件及其URL,长度(以字节为单位)以及每个文件的MD5散列值。
好吧,我可以轻松地从Azure存储中抽取前两项,但第三项似乎不会自动被Azure存储填充,我也无法找到任何方法来实现这一点。
不幸的是,其他选项看起来有限 到目前为止的可能性:
- 将文件下载到本地计算机,确定哈希值并更新Blob MD5值
- 查看我是否无法在可以计算散列值的相同区域中编写Azure函数应用程序,并将它写入容器中每个容器的blob
- 使用来自Data Factory的Amazon S3出口,然后使用Google的支持从S3导入,从https://cloud.google.com/storage/transfer/reference/rest/v1/TransferSpec#AwsS3Data获取,但这真的似乎浪费了带宽(我必须建立一个亚马逊账户)。
理想情况下,我希望能够编写一个脚本,打开并保持独立。 我没有Azure最快的下载速度,所以#1会比想要的要少,因为它需要很长时间。
有其他方法吗?
I have a number of files that I transferred into Azure Blob Storage via the Azure Data Factory. Unfortunately, this tool doesn't appear to set the Content-MD5 value for any of the values, so when I pull that value from the Blob Storage API, it's empty.
I'm aiming to transfer these files out of Azure Blob Storage and into Google Storage. The documentation I'm seeing for Google's Storagetransfer service at https://cloud.google.com/storage/transfer/reference/rest/v1/TransferSpec#HttpData indicates that I can easily initiate such a transfer if I supply a list of the files with their URL, length in bytes and an MD5 hash of each.
Well, I can easily pull the first two from Azure Storage, but the third doesn't appear to automatically get populated by Azure Storage, nor can I find any way to get it to do so.
Unfortunately, my other options look limited. In the possibilities so far:
- Download file to local machine, determine the hash and update the Blob MD5 value
- See if I can't write an Azure Functions app in the same region that can calculate the hash value and write it to the blob for each in the container
- Use an Amazon S3 egress from Data Factory and then use Google's support for importing from S3 to pull it from there, per https://cloud.google.com/storage/transfer/reference/rest/v1/TransferSpec#AwsS3Data but this really seems like a waste of bandwidth (and I'd have to set up an Amazon account).
Ideally, I want to be able to write a script, hit go and leave it alone. I don't have the fastest download rate from Azure, so #1 would be less than desireable as it'd take a long time.
Have any other approaches?
原文:https://stackoverflow.com/questions/41157327
最满意答案
你可以尝试这个 -
$str = "Product name (#15)"; preg_match('/\d+/', $str, $m); // Assuming only the id part will be in digits echo $m[0]; // 15
You can try this -
$str = "Product name (#15)"; preg_match('/\d+/', $str, $m); // Assuming only the id part will be in digits echo $m[0]; // 15
相关问答
更多-
除了在一个字符类( [] )内, ^字符并不意味着“不”。 如果您不想匹配任何内容,则可以使用与任何内容匹配的负面预览: (?!.*) 。 The ^ character doesn't mean "not" except inside a character class ([]). If you want to not match anything, you could use a negative lookahead that matches anything: (?!.*).
-
尝试这个 : ^[\\p{L}\\p{Digit}.'-.'_]*([^\\p{L}\\p{Digit}.'-.'_]).*$ 第一个不匹配的字符是组n°1 我在这里试了一下: http : //fiddle.re/gkkzm6 1 说明: 我否定了你的模式,所以我建立了这个: [^\\p{L}\\p{Digit}.'-.'_] [^...] means every character except for ^ ^ the fo ...
-
什么正则表达式匹配每个字符,除了逗号,'或分号';'?(What regex will match every character except comma ',' or semi-colon ';'?)[2022-10-23]
[^,;]+ 您尚未指定正在使用的正则表达式实现。 他们中的大多数都有一个Split方法,它使用分隔符并将其拆分。 您可能希望使用“普通”(不带^ )字符类: [,;]+ [^,;]+ You haven't specified the regex implementation you are using. Most of them have a Split method that takes delimiters and split by them. You mi ... -
正如@Tim Pietzcker建议的那样,添加PyPI包正则表达式 ,你可以使用递归正则表达式 。 >>> import regex >>> s = 'predicate(foo(x.bar, predicate(foo(...), bar)), bar)' >>> pattern = regex.compile(r'(\w+)(?=\(((?:\w+\((?2)\)|[^()])*)\))') >>> pattern.findall(s) [('predicate', 'foo(x.bar, predi ...
-
您的模式存在问题: [Az]范围不仅仅匹配小写和大写字母(请参阅[Az]和[a-zA-Z]差异 )。 要组合(?<=::)[a-zA-Z0-9_-]+和[a-zA-Z0-9_-]+(?=::) (注意带_和-的转义是多余的)你可以使用[a-zA-Z0-9_-]+::[a-zA-Z0-9_-]+ (注意::是匹配的一部分,因为正则表达式不匹配1匹配操作中的不连续文本所以无法避免)。 现在, [a-zA-Z0-9_]与Sublime Text中的\w因为\w也匹配所有Unicode字母和数字! 如果您不介意,可 ...
-
更改为以下正则表达式: ^(?:TCK)[0-9]+$ 演示: https : //regex101.com/r/h9V7n1/1 您正在使用的现有正则表达式的更改: 1)你在TCK周围使用[ , ] ,这意味着正则表达式必须匹配此括号内的任何一个值。 因为您必须按原样匹配TCK ,将其更改为( , ) 2)你没有在[0-9]之后提及+这意味着恰好会匹配一个匹配项。 但是,如果您要提及+ ,它将匹配一个或多个匹配项 Change to below regex: ^(?:TCK)[0-9]+$ Demo: ...
-
正则表达式匹配一个字符串(Regex Matching a string)[2022-04-15]
这可能是你的简单正则表达式: [^|]+ - 捕获一个或多个字符,直到达到“|” (或字符串结束) 或者你可以使用String.split(“|”); String line = "term * factor | factor"; String[] split = line.split("\\|"); This could be your simple regex: [^|]+ -capture one or more characters until you reach "|" (or end of ... -
答案是肯定的,通过两种不同的机制。 首先,您可以将lo包含在与整个正则表达式匹配的字符串部分中,但也可以在您关注的hel部分周围包含一个捕获组。 这是一个简单的sed演示,你会发现只找到一个匹配: sed -n 's/\(hel\)lo/\1/p' <<<$'hell\nhello\nhelen' 根据您的工具和目标,这可能就是您所需要的。 其次,您可以使用环视 - 在这种情况下, 积极 (因为您想确保某些东西在那里) 预测 (因为您希望它在匹配之后)。 grep的GNU实现有一个-P标志来启用与Perl ...
-
你可以尝试这个 - $str = "Product name (#15)"; preg_match('/\d+/', $str, $m); // Assuming only the id part will be in digits echo $m[0]; // 15 You can try this - $str = "Product name (#15)"; preg_match('/\d+/', $str, $m); // Assuming only the id part will be ...
-
你想使用preg_quote() 。 正如文件明确指出: preg_quote()接受str并在作为正则表达式语法一部分的每个字符前放置一个反斜杠。 如果您有一个需要在某些文本中匹配的运行时字符串,并且字符串可能包含特殊的正则表达式字符,这将非常有用。 或\Q ... \E ,( \Q和\E内容被视为普通字符,而不是正则表达式字符。) You want to use preg_quote(). As the documentation clearly states: preg_quote() takes s ...