databrickslabs/databricks-sync

Error: "name 'datetime' is not defined" thrown in terraform.py

rohitnijhawan opened this issue · 0 comments

This python file has no import python statement.

https://github.com/databrickslabs/databricks-sync/blob/master/databricks_sync/sdk/terraform.py#L157

As a result, this exception was thrown.

Traceback (most recent call last):
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/bin/databricks-sync", line 11, in <module>
    load_entry_point('databricks-sync==1.0.0', 'console_scripts', 'databricks-sync')()
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_cli-0.11.0-py3.7.egg/databricks_cli/configure/config.py", line 55, in decorator
    return function(*args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/cmds/config.py", line 178, in modify_user_agent
    return function(*args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/cmds/config.py", line 161, in decorator
    return function(*args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/click-8.0.1-py3.7.egg/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/cmds/apply.py", line 53, in import_cli
    te.execute()
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/sdk/sync/import_.py", line 28, in wrapper
    resp = func(self_, stage_path=stage_path, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/sdk/sync/import_.py", line 55, in wrapper
    resp = func(self_, repo_path=repo_path, **kwargs)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/sdk/sync/import_.py", line 167, in execute
    state_file_abs_path=state_loc)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/sdk/terraform.py", line 166, in apply
    backup_path = self.__get_backup_path(state_file_abs_path)
  File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-2c7138dd-643a-42c3-8ef2-cccf54ea51fc/lib/python3.7/site-packages/databricks_sync-1.0.0-py3.7.egg/databricks_sync/sdk/terraform.py", line 157, in __get_backup_path
    now_str = datetime.datetime.utcnow().strftime("%Y_%m_%d_%H_%M_%S_%f")
NameError: name 'datetime' is not defined