Live data from Hacker News

Show HN: Hashquery, a Python library for defining reusable analysis

hashquery.dev

1–10 of 19 posts

Show HN: Hashquery, a Python library for defining reusable analysis

#1
Hi all, we recently open sourced the first version of Hashquery, a Python library which lets you model analytics, DRY up common logic, and execute it against a database or warehouse.

We were originally rendering SQL directly for all our queries, but that spiraled out of control with more complex analysis; the SQL needed to be changed sporadically for each new database dialect (BigQuery, Redshift, Aethena, Postgres, etc etc) and the SQL fragments were very challenging to reuse (and so fragments were copy-pasted all over).

~~~

Advantages we think it has over writing SQL by hand:

- Queries are fully compossible, so any analysis can be chained into further analysis without refactoring.

- All analysis executes within the data warehouse itself, making them super fast for big data.

- It's just Python, so you can extend or parameterize query logic with a simple def function.

- You can run it anywhere, like inside of unit tests, ETL nodes, or Jupyter notebooks.

- Developer experience is pretty good since editors already know how to autocomplete Python. ChatGPT knows Python already too :)

- The library handles normalizing between database dialects. Write once and use in any database.

- Hashquery content is fully serializable, which makes it a good fit for exposing a flexible API for consumers to efficiently query datamarts or internal analytics. We use it as the endpoint for headless BI, as opposed to having to define and teach a DSL or GraphQL specification.

~~~

We've built native funnel analysis on top of Hashquery and have been thrilled with it so far, and we thought others might want to use it too. It's pretty early days so we're still trying to explain it, and the docs aren't perfectly clear, but the examples on the dev site are editable and you can download the pip package to play around with it!

Show HN: Hashquery, a Python library for defining reusable analysis
hashquery.dev

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#2
Looks pretty darn cool! Two questions please:

1. How does this compare to dbt? If we're already using dbt, why migrate?

2. Will you consider making a tool that tries to transpile SQL back to Hashquery models? This way I can work against my database, then merge the changes back to the model.

Good luck!

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#6
post #2

Looks pretty darn cool! Two questions please: 1. How does this compare to dbt? If we're already using dbt, why migrate? 2. Will you consider making a tool that tries to transpile SQL back to Hashquery models? This way I can work against my database, then merge the changes back to the model. Good luck!

I really don't understand the appeal of dbt vs a proper programming language. The templating approach leads to massive spaghetti. I look forward to trying out something like Ibis [0]

0: https://ibis-project.org/

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#7
I'm potentially super interested in this as am building this kind of feature for my job at the moment

But https://hashquery.dev/#faq says:

> the Hashquery SQL compiler is not available to run locally, so you do need to define your data connections inside of Hashboard and use its API to execute your queries.

> We do plan on making the full Hashquery stack available to run locally in the near future

I'm not quite sure what the use case for this library is at present

If I'm not a Hashboard customer and don't want to pay $60/mo for a nicer way to query my existing db, what am I going to do with it?

Hashboard seems roughly similar to Superset and/or Cube?

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#8
post #2

Looks pretty darn cool! Two questions please: 1. How does this compare to dbt? If we're already using dbt, why migrate? 2. Will you consider making a tool that tries to transpile SQL back to Hashquery models? This way I can work against my database, then merge the changes back to the model. Good luck!

I really don't understand the appeal of dbt vs a proper programming language. The templating approach leads to massive spaghetti. I look forward to trying out something like Ibis [0] 0: https://ibis-project.org/

You might not get the appeal of dbt because it is not meant for you. Dbt was made for data analyst who wanted the same engineering practices that software engineering teams have. The people who use it may have Python experience but they are not software engineers so dbt introduces concepts like testing and CI/CD to a group of people who don't historically use them.

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#9

I'm potentially super interested in this as am building this kind of feature for my job at the moment But https://hashquery.dev/#faq says: > the Hashquery SQL compiler is not available to run locally, so you do need to define your data connections inside of Hashboard and use its API to execute your queries. > We do plan on making the full Hashquery stack available to run locally in the near future I'm not quite sure…

Bit of context here is that Hashquery started as an internal tool and as a way to power our headless BI offering, so it still has a few bits tied to our infrastructure we're working to fully separate.

For folks wanting to hack around more with Hashquery in the meantime, Hashboard accounts can be created for free and we don't have plans to charge folks just using the Hashquery stuff (but we probably will bother you for feedback ). You can sign up here https://hashboard.com/getAccess

Re: Show HN: Hashquery, a Python library for defining reusable analysis

#10
post #2

Looks pretty darn cool! Two questions please: 1. How does this compare to dbt? If we're already using dbt, why migrate? 2. Will you consider making a tool that tries to transpile SQL back to Hashquery models? This way I can work against my database, then merge the changes back to the model. Good luck!

re: dbt, it looks like Hashquery is more for running analyses than doing in-data-warehouse transformations.

Unless I'm mistaken there's no native way in Hashquery right now to materialize the results back to your warehouse like you would with dbt.

Post reply on HN