首页 \ 问答 \ 以编程方式将文件从Azure Blob存储传输到Google云端存储(Transfer file from Azure Blob Storage to Google Cloud Storage programmatically)

以编程方式将文件从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存储填充,我也无法找到任何方法来实现这一点。

不幸的是,其他选项看起来有限 到目前为止的可能性:

  1. 将文件下载到本地计算机,确定哈希值并更新Blob MD5值
  2. 查看我是否无法在可以计算散列值的相同区域中编写Azure函数应用程序,并将它写入容器中每个容器的blob
  3. 使用来自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:

  1. Download file to local machine, determine the hash and update the Blob MD5 value
  2. 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
  3. 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
更新时间:2022-07-23 14:07

最满意答案

你可以尝试这个 -

$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 ...
  • [^,;]+ 您尚未指定正在使用的正则表达式实现。 他们中的大多数都有一个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: ...
  • 这可能是你的简单正则表达式: [^|]+ - 捕获一个或多个字符,直到达到“|” (或字符串结束) 或者你可以使用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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)