edx-enterprise-data 8.2.0__py3-none-any.whl → 8.3.0__py3-none-any.whl
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.
- {edx_enterprise_data-8.2.0.dist-info → edx_enterprise_data-8.3.0.dist-info}/METADATA +1 -1
- {edx_enterprise_data-8.2.0.dist-info → edx_enterprise_data-8.3.0.dist-info}/RECORD +7 -8
- enterprise_data/__init__.py +1 -1
- enterprise_data/admin_analytics/database.py +21 -2
- enterprise_data/admin_analytics/constants.py +0 -15
- {edx_enterprise_data-8.2.0.dist-info → edx_enterprise_data-8.3.0.dist-info}/LICENSE +0 -0
- {edx_enterprise_data-8.2.0.dist-info → edx_enterprise_data-8.3.0.dist-info}/WHEEL +0 -0
- {edx_enterprise_data-8.2.0.dist-info → edx_enterprise_data-8.3.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
enterprise_data/__init__.py,sha256=
|
1
|
+
enterprise_data/__init__.py,sha256=JHlSJ-Qb3ZQAeXmu39_pHVKHsKMJhrBFC4PUa-oeVtU,123
|
2
2
|
enterprise_data/apps.py,sha256=aF6hZwDfI2oWj95tUTm_2ikHueQj-jLj-u0GrgzpsQI,414
|
3
3
|
enterprise_data/clients.py,sha256=GvQupy5TVYfO_IKC3yzXSAgNP54r-PtIjidM5ws9Iks,3947
|
4
4
|
enterprise_data/constants.py,sha256=uCKjfpdlMYFZJsAj3n9RMw4Cmg5_6s3NuwocO-fch3s,238
|
@@ -10,9 +10,8 @@ enterprise_data/signals.py,sha256=8eqNPnlvmfsKf19lGWv5xTIuBgQIqR8EZSp9UYzC8Rc,10
|
|
10
10
|
enterprise_data/urls.py,sha256=bqtKF5OEWEwrNmHG3os-pZNuNsmjlhxEqp7yM4TbPf4,243
|
11
11
|
enterprise_data/utils.py,sha256=UruTQLJcEl-q5UWGPnJZrnBnV1OvzBvhuoB_JkRY4Is,2328
|
12
12
|
enterprise_data/admin_analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
enterprise_data/admin_analytics/constants.py,sha256=m7mK2PxkwnuzRAWlcPfMRdjY1r8D3dpA_i6PD0_aqBM,587
|
14
13
|
enterprise_data/admin_analytics/data_loaders.py,sha256=jP9CgUt_93Bl_ak1_6dBPN4PAEdDT1da3sEMjJ45NLg,4281
|
15
|
-
enterprise_data/admin_analytics/database.py,sha256=
|
14
|
+
enterprise_data/admin_analytics/database.py,sha256=mNS_9xE5h6O7oMMzr6kr6LDTTSNvKzo8vaM-YG8tOd8,1312
|
16
15
|
enterprise_data/admin_analytics/utils.py,sha256=Cock_rTtHkBEKcG3cq7VcYRPEuxC_SyJBlZn9KdVeCA,2465
|
17
16
|
enterprise_data/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
17
|
enterprise_data/api/urls.py,sha256=POqc_KATHdnpMf9zHtpO46pKD5KAlAExtx7G6iylLcU,273
|
@@ -148,8 +147,8 @@ enterprise_reporting/tests/test_send_enterprise_reports.py,sha256=WtL-RqGgu2x5PP
|
|
148
147
|
enterprise_reporting/tests/test_utils.py,sha256=Zt_TA0LVb-B6fQGkUkAKKVlUKKnQh8jnw1US1jKe7g8,9493
|
149
148
|
enterprise_reporting/tests/test_vertica_client.py,sha256=-R2yNCGUjRtoXwLMBloVFQkFYrJoo613VCr61gwI3kQ,140
|
150
149
|
enterprise_reporting/tests/utils.py,sha256=xms2LM7DV3wczXEfctOK1ddel1EE0J_YSr17UzbCDy4,1401
|
151
|
-
edx_enterprise_data-8.
|
152
|
-
edx_enterprise_data-8.
|
153
|
-
edx_enterprise_data-8.
|
154
|
-
edx_enterprise_data-8.
|
155
|
-
edx_enterprise_data-8.
|
150
|
+
edx_enterprise_data-8.3.0.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
|
151
|
+
edx_enterprise_data-8.3.0.dist-info/METADATA,sha256=II7SpGZtFiTm5AZirTzKkugBrYoyJ1PhWk25pBs98MY,1584
|
152
|
+
edx_enterprise_data-8.3.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
153
|
+
edx_enterprise_data-8.3.0.dist-info/top_level.txt,sha256=f5F2kU-dob6MqiHJpgZkFzoCD5VMhsdpkTV5n9Tvq3I,59
|
154
|
+
edx_enterprise_data-8.3.0.dist-info/RECORD,,
|
enterprise_data/__init__.py
CHANGED
@@ -4,12 +4,31 @@ Utility functions for interacting with the database.
|
|
4
4
|
from contextlib import closing
|
5
5
|
from logging import getLogger
|
6
6
|
|
7
|
-
from
|
7
|
+
from mysql.connector import connect
|
8
|
+
|
9
|
+
from django.conf import settings
|
10
|
+
|
8
11
|
from enterprise_data.utils import timeit
|
9
12
|
|
10
13
|
LOGGER = getLogger(__name__)
|
11
14
|
|
12
15
|
|
16
|
+
def get_db_connection(database=settings.ENTERPRISE_REPORTING_DB_ALIAS):
|
17
|
+
"""
|
18
|
+
Get a connection to the database.
|
19
|
+
|
20
|
+
Returns:
|
21
|
+
(mysql.connector.connection.MySQLConnection): The database connection.
|
22
|
+
"""
|
23
|
+
return connect(
|
24
|
+
host=settings.DATABASES[database]['HOST'],
|
25
|
+
port=settings.DATABASES[database]['PORT'],
|
26
|
+
database=settings.DATABASES[database]['NAME'],
|
27
|
+
user=settings.DATABASES[database]['USER'],
|
28
|
+
password=settings.DATABASES[database]['PASSWORD'],
|
29
|
+
)
|
30
|
+
|
31
|
+
|
13
32
|
@timeit
|
14
33
|
def run_query(query):
|
15
34
|
"""
|
@@ -22,7 +41,7 @@ def run_query(query):
|
|
22
41
|
(list): The results of the query.
|
23
42
|
"""
|
24
43
|
try:
|
25
|
-
with closing(
|
44
|
+
with closing(get_db_connection()) as connection:
|
26
45
|
with closing(connection.cursor()) as cursor:
|
27
46
|
cursor.execute(query)
|
28
47
|
return cursor.fetchall()
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Constants for admin analytics.
|
3
|
-
"""
|
4
|
-
import mysql.connector
|
5
|
-
|
6
|
-
from django.conf import settings
|
7
|
-
|
8
|
-
DATABASE_CONNECTION_CONFIG = {
|
9
|
-
'host': settings.DATABASES[settings.ENTERPRISE_REPORTING_DB_ALIAS]['HOST'],
|
10
|
-
'port': settings.DATABASES[settings.ENTERPRISE_REPORTING_DB_ALIAS]['PORT'],
|
11
|
-
'database': settings.DATABASES[settings.ENTERPRISE_REPORTING_DB_ALIAS]['NAME'],
|
12
|
-
'user': settings.DATABASES[settings.ENTERPRISE_REPORTING_DB_ALIAS]['USER'],
|
13
|
-
'password': settings.DATABASES[settings.ENTERPRISE_REPORTING_DB_ALIAS]['PASSWORD'],
|
14
|
-
}
|
15
|
-
DATABASE_CONNECTOR = mysql.connector.connect
|
File without changes
|
File without changes
|
File without changes
|