Fork me on GitHub
#sql
<
2019-04-02
>
seancorfield07:04:10

@metametadata I thought long and hard about the high-level syntactic sugar functions and decided to keep them in the top-level API because they handle things differently in some situations -- now that I've clarified how per-row functions worked in the core reducing API. If you look at the latest source, hopefully that will make sense.

metametadata09:04:46

Thanks for heads up. I like that they have "Syntactic sugar" comments now.

4
kwladyka09:04:54

What is your favourite solution to keep fresh DB for tests during developing? flyway ? Something similar?

kwladyka09:04:12

Also to keep updated DB on production

mping10:04:40

@kwladyka we're using migratus but flyway should be fine; only concern is if ddl is not transactional, if you have multiple servers running the same code you need to ensure it wont blow up if two of them do the same migration

kwladyka11:04:29

thanks for input

caleb.macdonaldblack23:04:39

How would you ensure that if two migrations are run at the same time they cause problems?

kwladyka07:04:14

Personally I will run migrations as separate job. Not on every app start.

kwladyka07:04:42

using for example flyway

kwladyka07:04:45

only not sure if I will do it from Clojure or from bash. Because maybe sometimes I will need to run extra complex things to change in DB, but not at that moment.

mping10:04:12

we reset the db for each test; bear in mind if you're using component you can even have a different db per test and run tests in parallel

metametadata12:04:42

We use joplin and write migrations in plain Clojure for max flexibility. For testing there's a second db running with optimized settings and before every test every table is TRUNCATEd.

souenzzo15:04:40

should jdbc-next be fully async? any function that do a IO call return a future channel?

metametadata16:04:04

but isn't JDBC API inherently synchronous?

metametadata16:04:02

ah, maybe you really mean jdbc-next and not next.jdbc

seancorfield16:04:49

Async JDBC is not on table yet. It's something I'll look at in due course.

Tomas Arruda de Almeida16:04:56

Hello Everyone! I am dealing with an issue right now, I would like to execute a query case insensitive… here is my code:

(defn save-to-primavera [db params]
  (as-> {:insert-into :Bookings
         :values      [params]} %
        (honeysql/format %)
        (jdbc/execute! db % {:return-keys true})))
I have a table “Bookings” (with upper-case B) but the execute! does not find my table, it tries to find a table called “bookings”… Do you know how I could execute this query in my “Bookings” table?

seancorfield17:04:00

@tomas.arruda Are you actually getting an error from that? I can't reproduce it locally.

seancorfield17:04:37

One thing you can try is (honeysql/format % :quoting :ansi) since it may be PostgreSQL itself that is changing Bookings to bookings without it being quoted.