I have an sql query that's returning the following value -
{'jobrun_deps': 'T=1 \x01ID=56494759 \x01DID=583887 \x01O=N \x01M=N \x01J=76732 \x01R=0 \x01P=1 \x01S=101 \x01WR=N \x01T=1 \x01ID=56494760 \x01DID=418400 \x01O=N \x01M=N \x01J=48064 \x01R=14780471 \x01P=1 \x01S=101 \x01WR=N \x01T=1 \x01ID=56494761 \x01DID=583889 \x01O=N \x01M=N \x01J=76733 \x01R=0 \x01P=1 \x01S=101 \x01WR=N \x01'}
So when I try to do this -
results = (re.findall(r'ID=(\d+)', my_query))
I get this error -
Traceback (most recent call last):
File "D:\Scripts\OPS\TIDAL\dependency_check.py", line 25, in <module>
results = (re.findall(r'ID=(\d+)', my_query))
File "D:\Python27\lib\re.py", line 177, in findall
return _compile(pattern, flags).findall(string)
TypeError: expected string or buffer
This is because the re.findall is expecting it to not have the column name in the results. how do I either change my re.findall to use the output I'm providing or change the sql query to give a string like it expects.
'T=1 \x01ID=56494759 \x01DID=583887 \x01O=N \x01M=N \x01J=76732 \x01R=0 \x01P=1 \x01S=101 \x01WR=N \x01T=1 \x01ID=56494760 \x01DID=418400 \x01O=N \x01M=N \x01J=48064 \x01R=14780471 \x01P=1 \x01S=101 \x01WR=N \x01T=1 \x01ID=56494761 \x01DID=583889 \x01O=N \x01M=N \x01J=76733 \x01R=0 \x01P=1 \x01S=101 \x01WR=N \x01'