Erlang library for embedding SQL queries and other structured data in separate files with named sections.
eql is an Erlang library that allows developers to store SQL queries in external files with named sections, making them accessible as functions in Erlang code. It provides an alternative to ORMs and SQL builders by keeping SQL in its natural form while adding convenient organization and parameterization. The library can also parse other structured data formats beyond SQL, such as configuration files.
Erlang developers working with databases who prefer writing raw SQL over using ORMs or query builders, and developers needing to manage external configuration files in Erlang projects.
Developers choose eql because it eliminates the complexity overhead of ORMs while providing better organization than inline SQL strings, offering the simplicity of Yesql's approach adapted for the Erlang ecosystem with additional flexibility for non-SQL use cases.
Erlang with SQL or not
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Stores SQL in separate .sql files with named sections, making queries easier to manage and locate compared to inline SQL strings, as shown in the user.sql example.
Queries are retrieved by name as if they were Erlang functions, improving code readability and reducing boilerplate, demonstrated with eql:get_query calls.
Supports both positional (?) and named parameters for dynamic query construction, allowing SQL to remain in files while adapting to runtime inputs.
Can parse any structured data with section markers, not just SQL, evidenced by the eql_config module for environment-specific configuration files.
Named parameters like :table are not sanitized, posing a SQL injection risk if user input is directly inserted, as warned in the README note.
Queries are compiled at runtime from files, so syntax errors or missing sections might only be caught during execution, not at compile time.
For non-SQL use cases like configuration parsing, extra steps or modules like eql_config are required, adding complexity compared to dedicated config libraries.