TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you organize your analytics/BI SQL code?

3 点作者 curl-up大约 2 年前
I&#x27;m primarily asking for the following scenario, but I&#x27;m interested in other relevant situations as well.<p>Imagine you are an analyst in a medium-sized company. Data analytics &#x2F; Business insights team you&#x27;re part of has somewhere between 5 and 20 people. Daily, you get questions from other departments for custom reports, dashboards and quick answers. Some of it is part of a bigger project that takes months and results in comprehensive dashboards, some of it is ad-hoc and will never be needed again, but you usually don&#x27;t know if some simple quick question will turn into a bigger thing. However, in all of these cases, most of the actual &quot;work&quot; is about writing, rewriting, modifying and maintaining SQL code.<p>My question is: how do you manage all that code? Is there a git repo where you follow some nice structure you defined? Do you build everything in DBT? Do you use fancy tools like Metabase? Do you store it in your data warehouse itself (e.g. as a stored procedure or view)? Do you just write the code and then throw it out because, the next time you need something like this, database would have changed anyway (or a completely new one will become the main source of data), so it makes no sense to even store it?<p>I&#x27;m intentionally not specifying the &quot;stack&quot; here, as I&#x27;d like to hear what actually works well, not what is just the least-bad option for a particular tech stack.<p>I&#x27;m especially happy to hear from people who have had bad experiences with whatever they chose to do, as I&#x27;m in the process of trying to solve this problem for my team and would really like to avoid as many mistakes as possible.

1 comment

PaulHoule大约 2 年前
I&#x27;d think the SQL statements would be baked into some other program that formats reports based on the SQL one way or the other. The whole program, SQL statements and all, would be managed with git. In Java, for instance, I&#x27;d store complex queries in &quot;*.sql&quot; files in the resource directory and have the Java program read them with getResource().<p>A real long time ago, I worked on a project where we did as much as we could with stored procedures in Microsoft SQL server and we built a script that did &quot;up&quot; and &quot;down&quot; migrations based on SQL code that was checked into Visual Source Safe.
评论 #35265607 未加载
评论 #35265590 未加载