使用ABFSS路径在Azure Data Lake中获取最新的修改时间
>>> os.stat("abfss://path")
FileNotFoundError: [Error 2] No such file or directory: 'abfss://path'
OS
软件包仅适用于安装点,但是我不允许在项目中使用安装点,还有其他方法可以获取最新的修改后的文件夹时间,该文件夹中存在于Azure Data Lake Storage中
答案: 这就是我终于做到的。
通过使用datalakeserviceclient
类
storage_account_url="{}://{}.dfs.core.windows.net".format("https",account_name)
service_client = DataLakeServiceClient(account_url=storage_account_url, credential=account_key)
directory_client = service_client.get_directory_client(container_name, directory_name)
directory_properties = directory_client.get_directory_properties()
last_modified_date = properties['last_modified']
>>> os.stat("abfss://path")
FileNotFoundError: [Error 2] No such file or directory: 'abfss://path'
os
package only works with mount points, but I'm not allowed to use mount points in my project, is there any other way to get the latest modified time of folder which is present in azure data lake storage
Answer:
This is how I finally did it.
by using DataLakeServiceClient
class
storage_account_url="{}://{}.dfs.core.windows.net".format("https",account_name)
service_client = DataLakeServiceClient(account_url=storage_account_url, credential=account_key)
directory_client = service_client.get_directory_client(container_name, directory_name)
directory_properties = directory_client.get_directory_properties()
last_modified_date = properties['last_modified']
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论