Skip to content

Commit 97130a6

Browse files
committed
Simplify mysql proptag query
1 parent 7862a47 commit 97130a6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

grommunio_exporter/grommunio_api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, mysql_config: dict, gromox_binary: Path, hostname: str):
4343
self.mysql_cnx = mysql.connector.connect(**mysql_config)
4444
# Avoid query cache
4545
self.mysql_cnx.autocommit = True
46-
46+
4747
self.mysql_cursor = self.mysql_cnx.cursor(dictionary=True)
4848

4949
# API status variable
@@ -273,7 +273,6 @@ def _get_mailbox_properties(self, usernames: List[str]):
273273
MAX(CASE WHEN user_properties.proptag = 805765184 THEN user_properties.propval_str END) AS creationtime,
274274
MAX(CASE WHEN user_properties.proptag = 1713176587 THEN user_properties.propval_str END) AS outofofficestate
275275
FROM user_properties INNER JOIN users ON user_properties.user_id=users.id
276-
WHERE user_properties.proptag IN (1718222851,235405332,1073020931,1718484995,805765184,1713176587)
277276
GROUP BY users.id;
278277
279278
Produces something like:
@@ -295,7 +294,6 @@ def _get_mailbox_properties(self, usernames: List[str]):
295294
MAX(CASE WHEN user_properties.proptag = 805765184 THEN user_properties.propval_str END) AS creationtime, \
296295
MAX(CASE WHEN user_properties.proptag = 1713176587 THEN user_properties.propval_str END) AS outofofficestate \
297296
FROM user_properties INNER JOIN users ON user_properties.user_id=users.id \
298-
WHERE user_properties.proptag IN (1718222851,235405332,1073020931,1718484995,805765184,1713176587) \
299297
GROUP BY users.id;"
300298
self.mysql_cursor.execute(query)
301299
mailbox_properties = self.mysql_cursor.fetchall()

0 commit comments

Comments
 (0)