tSQLike is my Python 3 module to work with tabular data using SQL approach with such “primitives” as “select” or “join”. The idea was to make the library small and useful, while for the rest of tasks you can still use Pandas or NumPy.
from tsqlike import tsqlike
t1 = tsqlike.Table(data=[['h1', 'h2', 'h3', 'h4'],
['a', 'b', 'c', 'd'],
['b', 'c', 'd', 'd'],
['f', 'g', 'h', 'i']],
name='first')
t2 = tsqlike.Table().import_list_dicts(data=[{'h1': 1, 'h2': 2, 'h3': 3},
{'h1': 'd', 'h2': 'e', 'h3': 'f'}],
name='second')
t3 = t1.join(t2, on='first.h4 == second.h1').select('*').order_by('second.h2', direction=tsqlike.ORDER_BY_DEC)
t3.write_csv(dialect='unix')
"first.h1", "first.h2", "first.h3", "first.h4", "second.h1", "second.h2", "second.h3"
"b", "c", "d", "d", "d", "e", "f"
"a", "b", "c", "d", "d", "e", "f"
Installation is simple as:
pip install tsqlike







