Comments (6)
It's totally do-able:
> (require '[honeysql.core :as hsql])
nil
> (hsql/format
(hsql/build :select :interesting_column :from :other_schema.important_table))
["SELECT interesting_column FROM other_schema.important_table"]
>
Is there another scenario where you're having trouble with this?
from honeysql.
Hm, that works, thanks. What I could not figure out is the same for function calls, based on this:
(require '[honeysql.core :as sql]
'[honeysql.helpers :refer :all])
(sql/format
(->
(select :wal_bytes_from_zero)
(from :%other_schema.get_database_cluster_information)))
["SELECT wal_bytes_from_zero FROM other_schema(get_database_cluster_information)"]
instead of
["SELECT wal_bytes_from_zero FROM other_schema.get_database_cluster_information()"]
from honeysql.
How about (sql/call :other_schema.get_database_cluster_information)
?
from honeysql.
Yeah, to follow on what @piranha is saying I'm not sure how to do it other than something like
(hsql/format
(hsql/build :select :wal_bytes_from_zero
:from (hsql/call :other_schema.get_database_cluster_information)))
If I think of a way to use the %
shorthand I'll add it to this issue...
from honeysql.
I don't know, I prefer sql/call
much more than :%
, since then query starts to look like line noise, plus you can't pass more than one argument (and it needs to be a column!).
from honeysql.
@piranha that's neat! I even agree that sql/call
is a cleaner solution - I've just missed this in the readme. Thanks, guys!
from honeysql.
Related Issues (20)
- Facilitate adding SQL keywords in between function arguments HOT 10
- Update docs for single keyword (symbol) uses? HOT 1
- Syntax for expanding records in PostgreSQL HOT 6
- :raw expects a single argument now HOT 1
- Improve exceptions/error reports HOT 2
- Postgres: On conflict update row with values where condition is met reports an error HOT 8
- HoneySQL2 makes all functions calls uppercase HOT 3
- Difficulties in converting documentation examples from hashmap form to helper function form HOT 5
- Postgres upsert support docs miss some of the supported cases
- `format` can emit syntactically invalid AS clauses HOT 1
- Nesting JOINs HOT 11
- Support H2's `TRUNCATE TABLE` syntax HOT 1
- Support for `postgres` "with ordinality" HOT 1
- Support for PostgreSQL interval type
- `:quoted` doesn't work together with `if exists` HOT 2
- Improve docs for UPDATE
- Does honeysql support pg's json path? HOT 4
- Use of VALUES with WITH should clarify it must be vector-of-vectors form
- ON CONFLICT should support expressions, not just entities
- formatf for positional parameter convenience? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeysql.