Coder Social home page Coder Social logo

Comments (6)

ddellacosta avatar ddellacosta commented on June 15, 2024

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.

avandras avatar avandras commented on June 15, 2024

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.

piranha avatar piranha commented on June 15, 2024

How about (sql/call :other_schema.get_database_cluster_information)?

from honeysql.

ddellacosta avatar ddellacosta commented on June 15, 2024

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.

piranha avatar piranha commented on June 15, 2024

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.

avandras avatar avandras commented on June 15, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.