Show HN:我为 NoSQL 数据库构建了一个 SQL 层

2作者: cammasmith3 个月前
在所有 NoSQL 数据库中,DynamoDB 是最令人头疼的查询数据库之一。MongoDB 拥有表达能力强的查询语言。Cassandra 有 CQL,它与 SQL 足够接近,大多数工程师可以很快上手。DynamoDB 提供了键条件表达式、保留字的属性名占位符,以及一个查询模型,你必须为每次调用手动选择正确的索引。PartiQL 存在,但不支持 JOIN、GROUP BY、子查询或大多数 ANSI SQL。 我构建了 DynamoSQL 来解决这个问题。 它接受任何 ANSI SQL SELECT 语句,并将其转换为正确的 DynamoDB API 调用。有趣的部分是索引选择:给定一个传入的查询,系统会检查表上可用的索引,找出最有效的访问模式,并构建调用。在可能的情况下进行分区键查找,如果更合适则使用二级索引,只有在万不得已时才进行扫描。 JOIN 是最复杂的部分。DynamoDB 本身不支持它们,因此它们在从两个表中获取数据后在客户端执行。支持的完整 SQL 列表包括 WHERE、所有 JOIN 类型、GROUP BY、HAVING、ORDER BY、LIMIT、UNION、INTERSECT、EXCEPT、子查询、CTE 以及各种聚合和字符串函数。 我们正在寻找 Beta 测试人员。如果你使用 DynamoDB 并希望对其运行 SQL,我很乐意收到你的反馈。 [https://dynamosql.com/](https://dynamosql.com/)
查看原文
Of all the NoSQL databases, DynamoDB is one of the most frustrating to query. MongoDB has an expressive query language. Cassandra has CQL, which is close enough to SQL that most engineers can pick it up quickly. DynamoDB gives you key condition expressions, attribute name placeholders for reserved words, and a query model where you have to pick the right index manually for every call. PartiQL exists but doesn&#x27;t support JOINs, GROUP BY, subqueries, or most of ANSI SQL.<p>I built DynamoSQL to fix that.<p>It accepts any ANSI SQL SELECT statement and converts it to the right DynamoDB API calls. The interesting part is the index selection: given an incoming query, the system inspects the available indexes on the table, figures out the most efficient access pattern, and constructs the call. Partition key lookup when possible, secondary index when that fits better, scan only as a last resort.<p>JOINs were the most involved part. DynamoDB doesn&#x27;t support them natively, so they execute client-side after fetching from both tables. The full list of supported SQL includes WHERE, all JOIN types, GROUP BY, HAVING, ORDER BY, LIMIT, UNION, INTERSECT, EXCEPT, subqueries, CTEs, and a wide range of aggregate and string functions.<p>We&#x27;re looking for beta testers. If you work with DynamoDB and want to run SQL against it, I&#x27;d like to hear from you.<p><a href="https:&#x2F;&#x2F;dynamosql.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dynamosql.com&#x2F;</a>