dataflow-core 1.0.0__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dataflow-core might be problematic. Click here for more details.

Files changed (32) hide show
  1. dataflow_core-2.0.1/PKG-INFO +10 -0
  2. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/README.md +0 -0
  3. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/__init__.py +0 -0
  4. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/dataflowairflowauthenticator.py +1 -1
  5. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/dataflowhubauthenticator.py +0 -0
  6. dataflow_core-2.0.1/authenticator/dataflowsupersetauthenticator.py +57 -0
  7. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/__init__.py +0 -0
  8. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/configuration.py +0 -0
  9. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/models/__init__.py +0 -0
  10. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/models/database.py +0 -0
  11. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/models/session.py +0 -0
  12. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/authenticator/package/models/user.py +0 -0
  13. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/__init__.py +0 -0
  14. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/configuration.py +0 -0
  15. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/dataflow.py +3 -2
  16. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/models/__init__.py +0 -0
  17. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/models/database.py +0 -0
  18. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/models/session.py +0 -0
  19. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/models/user.py +0 -0
  20. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/utils/__init__.py +0 -0
  21. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow/utils/aws_secrets_manager.py +0 -0
  22. dataflow_core-2.0.1/dataflow_core.egg-info/PKG-INFO +10 -0
  23. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow_core.egg-info/SOURCES.txt +1 -0
  24. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow_core.egg-info/dependency_links.txt +0 -0
  25. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow_core.egg-info/entry_points.txt +0 -1
  26. dataflow_core-2.0.1/dataflow_core.egg-info/requires.txt +4 -0
  27. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/dataflow_core.egg-info/top_level.txt +0 -0
  28. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/setup.cfg +0 -0
  29. {dataflow-core-1.0.0 → dataflow_core-2.0.1}/setup.py +4 -2
  30. dataflow-core-1.0.0/PKG-INFO +0 -10
  31. dataflow-core-1.0.0/dataflow_core.egg-info/PKG-INFO +0 -10
  32. dataflow-core-1.0.0/dataflow_core.egg-info/requires.txt +0 -2
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: dataflow-core
3
+ Version: 2.0.1
4
+ Summary: Dataflow core package
5
+ Author: Dataflow
6
+ Author-email:
7
+ Requires-Dist: sqlalchemy
8
+ Requires-Dist: boto3
9
+ Requires-Dist: psycopg2-binary
10
+ Requires-Dist: pymysql
File without changes
@@ -60,7 +60,7 @@ class DataflowAirflowAuthenticator(FabAirflowSecurityManagerOverride):
60
60
 
61
61
  if not user:
62
62
  user_role = self.find_role(user_data.role.title())
63
- user = self.add_user(username=user_data.user_name, first_name=self.not_none(user_data.first_name), last_name=self.not_none(user_data.last_name), email=self.not_none(user_data.email), role=user_role)
63
+ user = self.add_user(username=user_data.user_name, first_name=self.not_none(user_data.first_name), last_name=self.not_none(user_data.last_name), email=self.not_none(user_data.email), role=user_role, password=self.not_none(user_data.password))
64
64
 
65
65
  environ['REMOTE_USER'] = user.username
66
66
  self.write_user_id(user_data.user_id)
@@ -0,0 +1,57 @@
1
+ from flask import redirect, request
2
+ from flask_appbuilder.security.views import AuthDBView
3
+ from superset.security import SupersetSecurityManager
4
+ from flask_appbuilder.security.views import expose
5
+ from flask_login import login_user
6
+ from .package.configuration import ConfigurationManager
7
+ from .package.models.database import DatabaseManager
8
+ from .package.models import (
9
+ user as m_user,
10
+ session as m_session
11
+ )
12
+
13
+ class CustomAuthDBView(AuthDBView):
14
+ def __init__(self):
15
+ self.dataflow_config = ConfigurationManager('/dataflow/app/config/dataflow.cfg')
16
+ self.dataflow_database_url = self.dataflow_config.get_config_value('database', 'database_url')
17
+ self.dataflow_db_instance = DatabaseManager(self.dataflow_database_url)
18
+ self.dataflow_db = next(self.dataflow_db_instance.get_session())
19
+ m_user.Base.metadata.create_all(bind=self.dataflow_db_instance.get_engine())
20
+ m_session.Base.metadata.create_all(bind=self.dataflow_db_instance.get_engine())
21
+
22
+ def _get_user_id_from_session(self, session_id):
23
+ query = self.dataflow_db.query(m_session.Session_table).filter(m_session.Session_table.session_id == session_id).first()
24
+ return query.user_id if query!=None else None
25
+
26
+ def _get_user_details_from_user_table(self, user_id):
27
+ user_details = self.dataflow_db.query(m_user.User).filter(m_user.User.user_id == user_id).first()
28
+ return user_details if user_details!=None else None
29
+
30
+ def not_none(self, value):
31
+ return value if value is not None else ""
32
+
33
+ @expose('/login/', methods=['GET'])
34
+ def login(self):
35
+ try:
36
+ session_id = request.cookies.get('dataflow_session')
37
+
38
+ user_id = self._get_user_id_from_session(session_id)
39
+ user_details = self._get_user_details_from_user_table(user_id)
40
+ user = self.appbuilder.sm.find_user(username=user_details.user_name)
41
+ if user:
42
+ login_user(user, remember=False)
43
+ else:
44
+ user = self.appbuilder.sm.add_user(username=self.not_none(user_details.user_name), first_name=self.not_none(user_details.first_name), last_name=self.not_none(user_details.last_name), email=self.not_none(user_details.email), role=self.appbuilder.sm.find_role('Admin'), password=self.not_none(user_details.password))
45
+ if user:
46
+ login_user(user, remember=False)
47
+
48
+ return redirect(self.appbuilder.get_url_for_index)
49
+
50
+ except Exception as e:
51
+ return super().login()
52
+
53
+
54
+ class CustomSecurityManager(SupersetSecurityManager):
55
+ authdbview = CustomAuthDBView
56
+ def __init__(self, appbuilder):
57
+ super(CustomSecurityManager, self).__init__(appbuilder)
@@ -47,8 +47,9 @@ class Dataflow:
47
47
  host_name = os.environ["HOSTNAME"]
48
48
  user_name = host_name.replace("jupyter-","")
49
49
 
50
- vault_path = "variable"
51
- return self.secrets_manager.get_secret_by_key(vault_path, user_name, variable_name)
50
+ vault_path = "variables"
51
+ variable_data = self.secrets_manager.get_secret_by_key(vault_path, user_name, variable_name)
52
+ return variable_data['value']
52
53
 
53
54
  except Exception as e:
54
55
  return None
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: dataflow-core
3
+ Version: 2.0.1
4
+ Summary: Dataflow core package
5
+ Author: Dataflow
6
+ Author-email:
7
+ Requires-Dist: sqlalchemy
8
+ Requires-Dist: boto3
9
+ Requires-Dist: psycopg2-binary
10
+ Requires-Dist: pymysql
@@ -3,6 +3,7 @@ setup.py
3
3
  authenticator/__init__.py
4
4
  authenticator/dataflowairflowauthenticator.py
5
5
  authenticator/dataflowhubauthenticator.py
6
+ authenticator/dataflowsupersetauthenticator.py
6
7
  authenticator/package/__init__.py
7
8
  authenticator/package/configuration.py
8
9
  authenticator/package/models/__init__.py
@@ -1,3 +1,2 @@
1
1
  [jupyterhub.authenticators]
2
2
  dataflow_authenticator = authenticator.dataflowhubauthenticator:DataflowHubAuthenticator
3
-
@@ -0,0 +1,4 @@
1
+ sqlalchemy
2
+ boto3
3
+ psycopg2-binary
4
+ pymysql
File without changes
@@ -2,13 +2,15 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="dataflow-core",
5
- version="1.0.0",
5
+ version="2.0.1",
6
6
  packages=find_packages(exclude=["tests", "tests.*"]),
7
7
  include_package_data=True,
8
8
  package_data={},
9
9
  install_requires=[
10
10
  'sqlalchemy',
11
11
  'boto3',
12
+ 'psycopg2-binary',
13
+ 'pymysql'
12
14
  ],
13
15
  author="Dataflow",
14
16
  author_email="",
@@ -18,4 +20,4 @@ setup(
18
20
  'dataflow_authenticator = authenticator.dataflowhubauthenticator:DataflowHubAuthenticator',
19
21
  ],
20
22
  },
21
- )
23
+ )
@@ -1,10 +0,0 @@
1
- Metadata-Version: 1.0
2
- Name: dataflow-core
3
- Version: 1.0.0
4
- Summary: Dataflow core package
5
- Home-page: UNKNOWN
6
- Author: Dataflow
7
- Author-email: UNKNOWN
8
- License: UNKNOWN
9
- Description: UNKNOWN
10
- Platform: UNKNOWN
@@ -1,10 +0,0 @@
1
- Metadata-Version: 1.0
2
- Name: dataflow-core
3
- Version: 1.0.0
4
- Summary: Dataflow core package
5
- Home-page: UNKNOWN
6
- Author: Dataflow
7
- Author-email: UNKNOWN
8
- License: UNKNOWN
9
- Description: UNKNOWN
10
- Platform: UNKNOWN
@@ -1,2 +0,0 @@
1
- sqlalchemy
2
- boto3