Skip to content

slott56/functional-SQL

Repository files navigation

functional-SQL

Python ruff-linter pyright-checker license sphinx

A library to help build SQL-like functionality without the overhead of a database.

See https://slott56.github.io/functional-SQL/_build/html/index.html for the documentation.

Some SQL

SELECT n.name, v.c2
FROM names_table n, values_table v
WHERE n.code = v.c1

Some Python that does the same thing.

Select(name=lambda cr: cr.n.name, value=lambda cr: cr.v.c2)
.from_(n=names_table, v=values_table)
.where(lambda cr: cr.n.code == cr.v.c1)

Yes. The Python is longer. Yes it has lambda cr: cr. scattered around. The Python produces the same results as the SQL query, using essentially the same algorithm. You can write Python using the SQL algorithm design pattern. And without using a database.

About

An approach to writing function Python that parallels the concepts underlying the SQL select

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages