Skip to content

Commit

Permalink
Address #174: dbapi2 parsing bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaack committed Oct 28, 2015
1 parent 2bf9aba commit c16f924
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion services/core/SQLHistorian/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

setup(
name = package + 'agent',
version = "3.0",
version = "3.0.1",
install_requires = ['volttron', 'ply'],
packages = packages,
entry_points = {
Expand Down
8 changes: 8 additions & 0 deletions volttron/platform/agent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

import argparse
from dateutil.parser import parse
from datetime import timedelta
import logging
import os
import pytz
Expand All @@ -85,6 +86,8 @@
re.MULTILINE | re.DOTALL)


_log = logging.getLogger(__name__)

def _repl(match):
'''Replace the matched group with an appropriate string.'''
# If the first group matched, a quoted string was matched and should
Expand Down Expand Up @@ -282,6 +285,11 @@ def process_timestamp(timestamp_string):

try:
timestamp = parse(timestamp_string)

#The following addresses #174: error with dbapi2
if not timestamp.microsecond:
_log.warn("No microsecond in timestamp. Adding 1 to prevent dbapi2 bug.")
timestamp = timestamp + timedelta(microseconds = 1)
except (ValueError, TypeError) as e:
_log.error("message for {topic} bad timetamp string: {ts_string}".format(topic=topic,
ts_string=timestamp_string))
Expand Down

0 comments on commit c16f924

Please sign in to comment.