0

I am using the row_prefix in the table.scan method to filter the rows. The problem is that the function works when a string literal is used. However, if a variable is used no data is returned.

For example, the following code is working

connection = happybase.Connection(connect string)
table = connection.table('table')
table = table.scan(row_prefix='abc001', include_timestamp=False)

But the following code does not return any data

connection = happybase.Connection(connect string)
table = connection.table('table')

query = '\'{0}{1}\''.format(args['str1'], args['str2'])
table = table.scan(row_prefix=query, include_timestamp=False)

There is no error in the 2nd case.

Raj
  • 3
  • 1
  • 1
    try printing the value of "query" before passing to scan. are you getting the same value as first query? – Nirmal Ram Nov 14 '16 at 07:18
  • yes, the query string is correct. In fact, I took the generated string and copied it in the scan method and it works – Raj Nov 15 '16 at 02:20

1 Answers1

0

replace '\'{0}{1}\'' with '{0}{1}' in query value and try again

Nirmal Ram
  • 1,180
  • 2
  • 9
  • 18