data_lake_4.py 742 B

1234567891011121314
  1. def get_conn(self) -> core.AzureDLFileSystem:
  2. """Return a AzureDLFileSystem object."""
  3. if not self._conn:
  4. conn = self.get_connection(self.conn_id)
  5. service_options = conn.extra_dejson
  6. self.account_name = service_options.get('account_name') or service_options.get(
  7. 'extra__azure_data_lake__account_name'
  8. )
  9. tenant = service_options.get('tenant') or service_options.get('extra__azure_data_lake__tenant')
  10. adl_creds = lib.auth(tenant_id=tenant, client_secret=conn.password, client_id=conn.login)
  11. self._conn = core.AzureDLFileSystem(adl_creds, store_name=self.account_name)
  12. self._conn.connect()
  13. return self._conn