Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError in schema size check #5043

Merged

Conversation

rayatbuzzfeed
Copy link
Contributor

@rayatbuzzfeed rayatbuzzfeed commented Nov 19, 2019

What does this PR do?

This fixes a TypeError exception when it returns null from a non base table such as those in the view or sys db

TypeError: long() argument must be a string or a number, not 'NoneType'\
\"}]"}

Motivation

Getting pass the above error in checks. It now returns 0 if null instead of none.

example DBs that would return null:

mysql> select table_schema, data_length, index_length from information_schema.tables group by table_schema;
+--------------------+-------------+--------------+
| table_schema       | data_length | index_length |
+--------------------+-------------+--------------+
| information_schema |           0 |            0 |
| mysql              |      515970 |        53248 |
| performance_schema |           0 |            0 |
| sys                |        NULL |         NULL |
| tmp                |       16384 |        32768 |
| view               |        NULL |         NULL |
+--------------------+-------------+--------------+
9 rows in set (0.04 sec)

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@rayatbuzzfeed rayatbuzzfeed requested a review from a team as a code owner November 19, 2019 18:35
…and gets a TypeError. This defaults to 0 if null instead of none
@rayatbuzzfeed rayatbuzzfeed force-pushed the rw/fix-nonetype-mysql-schema-check-issue branch from 6fb8ffc to 5f2ee2d Compare November 19, 2019 19:30
@therve therve changed the title datadog/mysql: fixed TypeError in schema size check Fix TypeError in schema size check Nov 20, 2019
@therve therve merged commit eabdf08 into DataDog:master Nov 20, 2019
@rayatbuzzfeed rayatbuzzfeed deleted the rw/fix-nonetype-mysql-schema-check-issue branch November 20, 2019 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants