Below is the traceback, with the Oracle driver. Looks like it is induced by supplying non-character field names derived from the cursor description to namedtuple()
like this. I should make time to test with other backends / submit a PR, but dont have any today, so this issue is a placeholder/FYI. I can get past it for now by switching to the dict_rowfactory
get_rows("select count(*) from BGS.LXN_UNIT", db())
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-529dbe5276a5> in <module>
----> 1 get_rows("select count(*) from TABLENAME", db())
~/env/lib/python3.6/site-packages/etlhelper/etl.py in get_rows(select_query, conn, parameters, row_factory, transform)
133 """
134 return list(iter_rows(select_query, conn, row_factory=row_factory,
--> 135 parameters=parameters, transform=transform))
136
137
~/env/lib/python3.6/site-packages/etlhelper/etl.py in iter_rows(select_query, conn, parameters, row_factory, transform, read_lob)
115 for chunk in iter_chunks(select_query, conn, row_factory=row_factory,
116 parameters=parameters, transform=transform,
--> 117 read_lob=read_lob):
118 for row in chunk:
119 yield row
~/env/lib/python3.6/site-packages/etlhelper/etl.py in iter_chunks(select_query, conn, parameters, row_factory, transform, read_lob)
61
62 # Set row factory
---> 63 create_row = row_factory(cursor)
64
65 # Parse results
~/env/lib/python3.6/site-packages/etlhelper/row_factories.py in namedtuple_rowfactory(cursor)
17 column_names = [d[0] for d in cursor.description]
18
---> 19 Row = namedtuple('Row', field_names=column_names)
20
21 def create_row(row):
/usr/local/lib/python3.6/collections/__init__.py in namedtuple(typename, field_names, verbose, rename, module)
399 if not name.isidentifier():
400 raise ValueError('Type names and field names must be valid '
--> 401 'identifiers: %r' % name)
402 if _iskeyword(name):
403 raise ValueError('Type names and field names cannot be a '
ValueError: Type names and field names must be valid identifiers: 'COUNT(*)'