Hello,
We have just released Slick 2.0.0-M3, the third milestone for Slick 2.0. It should show up on Maven Central within the next few hours. You can find the source code here: https://github.com/slick/slick/tree/2.0.0-M3. Please see http://slick.typesafe.com/docs/ for documentation.
We published M2 in July but it was never officially announced and did not come with updated documentation, so these release notes include the changes for both, M2 and M3.
Table definitions in the Lifted Embedding use a new syntax which is slightly more verbose but also more robust and logical, avoiding several pitfalls from earlier versions.
Table definitions (and their *
projections)
are not restricted to flat
tuples of columns anymore. They can use any type that would
be valid as the
return type of a Query. The old projection concatenation
methods ~
and ~:
are still supported but not imported by default.
In addition to Scala tuples, Slick supports its own HList
abstraction for
records of arbitrary size. You can also add support for your
own record types
with only a few lines of code. All record types can be used
everywhere
(including table definitions and mapped projections) and
they can be mixed
and nested arbitrarily.
Some changes to the API to bring it closer to Scala Collections syntax.
threadLocalSession
has been renamed to dynamicSession
and the corresponding
methods have distinct names (e.g. withDynSession
vs the standard withSession
).
This allows the use of the standard methods without extra
type annotations.
Thread-local sessions are not deprecated but we want to push
explicit session
management (with the now simpler syntax) as the default.
Some important parts of the query compiler have been
rewritten. Column flattening
and the emulation of Boolean
which is required
by some databases should now be
more robust.
Soft inserts are now the default, i.e. AutoInc
columns are automatically skipped
when inserting with +=
, ++=
, insert
and insertAll
. This means that you no
longer need separate projections (without the primary key)
for inserts.
There are separate methods forceInsert
and forceInsertAll
in JdbcProfile
for
the old behavior.
A new model for pre-compiled queries replaces the old QueryTemplate
abstraction.
Any query (both, actual collection-valued Query
objects and scalar queries) or
function from Column
types to such a query can
now be lifted into a Compiled
wrapper. Lifted functions can be applied (without having to
recompile the query),
and you can use both monadic composition of Compiled
values or just get the
underlying query and use that for further composition.
Note that this is not a production-ready or beta release. The Slick Extensions package is not available for this milestone release and the Slick Examples and Slick Testkit Example projects have not been updated yet.
We expect that the next published version of Slick will be 2.0.0-RC1 which will integrate code-generator-based type providers and add more documentation and bug fixes. It will also come with an updated Slick Extensions package.
b70a2c7
Update build for 2.0.0-M31c488ea
Deprecate notIn, add filterNot for orthogonality and
conformity with Scala collections see https://github.com/slick/slick/pull/204d1849b8
Add a separate compiler phase for boolean emulation.32e8cee
bumped scala to 2.10.3, sbt to 0.13.0, mima to 0.1.624b0ed7
Fix existing doctests, execute all doctests (including
required fixes)2a4d156
Fix fusion of Take and Drop operators.3464b5e
Fix compilation error introduced by merging #232 and #243
together.48f0648
Add test case for multi-level mapping with <>, prompted
by issue #78.c2eb8da
Add createDDLInvoker (similar to createInsertInvoker).c897ad9
Add HList and Nat implementations with Shapes for the HList.d6428b7
Simplify custom Shape definitions99f19fc
Use bind variables for types which do not support literals.68996f0
Skip AutoInc columns by default when inserting data.bda93a7
Introduce “Compiled” computations to replace parameterized
queries.4ee1c5c
Treat Unit as an empty product type.bbf9694
Add a common abstraction for literal and parameter columns.b8eaa59
Improve Shape encoding to support Columns-level Shapes.942d98f
Add a nested Shape for Queries.f16915d
Allow unit tests which assure that some code does not
type-check.ff992bb
Add Shape levels to differentiate between flat and nested
Shapes.e9d6f69
Running a query to match a specific UUID in MySQL fails in
1.0.1. For example, the following code will fail with error
“UUID does not support a literal representation”.1c1bf30
Fuse simple mappings before resolving GroupBy.009dc35
Flatten nested ProductNodes in GroupBy keys.01410cd
Use fixed version numbers for fmpp’s dependencies.d054bf5
Rename .elements to .iterator.64b1a12
Allow identity (primary key auto-increment) types to be
overridden.2721a90
Quote the table name correctly in InsertBuilder.1be8a52
Add hashCode() implementation to ProductValue.5be75d3
Add regression test for grouping by 3 columns.05ded5c
Add documentation about using connection pools.57d886f
Update documentation for new table definitions and tuple
syntax.b28d2a1
Fix build for building against Scala 2.1174ecd59
Don’t mark types as observed in dumps and when building typed
copies.56cdd2d
Fix MatchError in tree dumps.3efe3d6
Fix typos81e50a7
Fix code style, transaction example, line wrap, search button
layout, typos8829bf9
updates docs to not show dynamicSession as default621947a
adjusted docs to match changes regarding dynamicSession in
83d470796c2836d1a66d5b00726bc152bec63ac698eee6d
fixes compilation errors in dockets:test (which somehow
creeped in)5bb13eb
adjusted docs for OSXc3b771a
Add Google Analytics token to the generated docs fixes
assembla ticket #188d755e69
added connection / transaction docsa67ca6c
changed to docs Slick themee75919e
prepare for theme change (code lines < 100 chars)fa3c659
Add some scaladoc comments to the lifted embedding.353a260
Update the Typesafe Project & Developer Guidelines.27fc9ca
Remove some cruft from the AST.5bc8d29
Implement the new column expansion and flattening scheme.7b114bf
Find all referenced table columns in inferTypes.29fc842
Create a TableExpansion when creating a TableNode.697dc78
Simplify tagging and ref encoding.e33ba26
Simplify the Shape API + implementation and MapperTeste0c8db6
Support for easy type mapping in Shapes.9e566e2
Remove Node.apply and rename NodeGenerator.nodeDelegate to
.toNode.379b649
Move the conversion of values to Nodes into Shape.78bad9e
Move encodeRef functionality for container types into Shape.5e98612
Simplify the creation of packed Shape of QueryParameters.531607d
fixes doctest:test compilation errors introduced by
83d470796c2836d1a66d5b00726bc152bec63ac6db9116d
Slick 2.0.0-M2 release36f95d7
Use the ++ operator for unionAll.5978155
Allow the use of += and ++= for more complex inserts in
JdbcProfile.b16cbc5
Improve threadLocalSession API6cd987e
Make tuple extension methods optional.820670b
Sprinkle some macro sugar on TableQuery.6a3467e
Introduce the new table model.5506063
Add query-based DDL and Insert APIs.cf1b244
Complete separation of Nodes and Reps.2f6e031
Disentangle lifted embedding tables from TableNodes.73c79b3
Remove WithOp.cd1e60c
Rebase topic/tuples-everywhere.8239fb7
Simplify typing of Nodes.64e1f6b
Some minor cleanup worka63846d
Remove “by” Symbol from GroupBy.11afbd6
Implement SQL-like count(*) semantics workaround in
QueryInterpreter.83c487d
Improve handling of types in the AST and query compiler.--
---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
....and Slick Testkit Example projects have not been updated yet.
Testkit is part of the main codebase and used to test Slick itself. It is always up to date and published along with every version. It's only the testkit-example project that hasn't been updated.
We have just released Slick 2.0.0-M3, the third milestone for Slick 2.0. It should show up on Maven Central within the next few hours. You can find the source code here: https://github.com/slick/slick/tree/2.0.0-M3. Please see http://slick.typesafe.com/docs/ for documentation.
--
Quite impressive list of improvements! Congrats Stefan, Christopher and Typesafe! This one particularly catches my eyes: - A new model for pre-compiled queries replaces the old QueryTemplate abstraction. Any query (both, actual collection-valued Query objects and scalar queries) or function from Column types to such a query can now be lifted into a Compiledwrapper. Lifted functions can be applied (without having to recompile the query), and you can use both monadic composition of Compiled values or just get the underlying query and use that for further composition. Can I compose both compiled and non-compiled queries in a single query? I suppose composing compiled values still carries a cost, hopefully a lot cheaper than raw Query objects.
You can tell Slick how to connect to the database of your choice by creating a Database object,
// use the right Slick version here: "com.typesafe.slick" %% "slick" % "2.0.0",
def foo(implicit session: Session) { ... }
Hi Reid,
Slick-2.0.0-M3 is a milestone release, not a stable release. So expect
(and please report :)) some issues, which should be fixed when we
release Slick-2.0.0-RC1.
Stuff moved around in Slick's code internally and the documentation is
lacking behind. The Database class is now
http://slick.typesafe.com/doc/2.0.0-M3/api/#scala.slick.jdbc.JdbcBackend$DatabaseFactoryDef
. But you still the same old Database.forURL or Database.forDataSource.
User code stayed mostly the same except for a few things. The `Tag`
argument to table classes and tuples in projections (like the `*`
projection) come to mind.
Introduce “Compiled” computations to replace parameterized queries.
* |4ee1c5c|
<https://github.com/slick/slick/commit/4ee1c5ca9bd0fce645188bb098fabf73134750fe>
Treat Unit as an empty product type.
* |bbf9694|
<https://github.com/slick/slick/commit/bbf9694a1f4cd3e7f792770be808add9ba5679a7>
Add a common abstraction for literal and parameter columns.
* |b8eaa59|
<https://github.com/slick/slick/commit/b8eaa59af22e7e8667da91f03e352b0fce85e5c6>
Improve Shape encoding to support Columns-level Shapes.
* |942d98f|
<https://github.com/slick/slick/commit/942d98fc304a1349162b4040e4c16484291f50da>
Add a nested Shape for Queries.
* |f16915d|
<https://github.com/slick/slick/commit/f16915d8e61e2cd48cdf85649cbbd04ce0fd3e2d>
Allow unit tests which assure that some code does not type-check.
* |ff992bb|
<https://github.com/slick/slick/commit/ff992bb492129674ba730e5e5503eae43d66afd0>
Add Shape levels to differentiate between flat and nested Shapes.
* |e9d6f69|
<https://github.com/slick/slick/commit/e9d6f6927d1d84493849b96d3759f4ad6d4c5b32>
Running a query to match a specific UUID in MySQL fails in
1.0.1. For example, the following code will fail with error
“UUID does not support a literal representation”.
* |1c1bf30|
<https://github.com/slick/slick/commit/1c1bf30b5265cc33cfb85156d34d55f53457dd9b>
Fuse simple mappings before resolving GroupBy.
* |009dc35|
<https://github.com/slick/slick/commit/009dc3506f912533338f02366fcfaadacf4a3fed>
Flatten nested ProductNodes in GroupBy keys.
* |01410cd|
<https://github.com/slick/slick/commit/01410cdbd28c43b88e64759d83c173bb6798784e>
Use fixed version numbers for fmpp’s dependencies.
Don’t mark types as observed in dumps and when building typed
Remove “by” Symbol from GroupBy.
* |11afbd6|
<https://github.com/slick/slick/commit/11afbd637351bea16bfdbdcf242d1c0ce582c97f>
Implement SQL-like count(*) semantics workaround in
QueryInterpreter.
* |83c487d|
<https://github.com/slick/slick/commit/83c487ded5e79804a4f4e45e9214e6e4e04bac8d>
Improve handling of types in the AST and query compiler.
--
Stefan Zeiger
/Slick <http://slick.typesafe.com> Tech Lead/
Typesafe <http://typesafe.com> - Build Reactive Apps!
Twitter: @StefanZeiger <http://twitter.com/#%21/StefanZeiger>
--
---
You received this message because you are subscribed to the Google
Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to scalaquery+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
---
You received this message because you are subscribed to a topic in the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalaquery/xNtPT6sexXI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalaquery+...@googlegroups.com.
Note that this is not a production-ready or beta release. The Slick Extensions package is not available for this milestone release and the Slick Examples and Slick Testkit Example projects have not been updated yet.
Chris,
None of my code wants to assume a particular driver. I fully intend, at some point, to write a completely asynch driver that is not JDBC based. �Because of slick�s type safety, I have some guarantees that my existing code will work as well as that driver�s implementation eventually will. So, to suggest that I map Session to a PARTICULAR driver�s implementation really does not sit well with me. It needs to work with ANY database driver. My clients can pick from among any supported by slick (and eventually by my own drivers).
If I�m working generically (abstractly), isn�t the correct definition more like:
type Session = scala.slick.backend.DatabaseComponent.SessionDef
I note that there are four DatabaseFactoryDef definitions in a variety of places:
scala.slick.backend.DatabaseComponentscala.slick.jdbc.JdbcBackendscala.slick.memory.DistributedBackendscala.slick.memory.HeapBackend
It is very important for my use case that my use of Slick can work with any database backend, JDBC or not. So, I�m suspecting that in the generic (abstract) case, I want to use scala.slick.backend.DatbaseComponent and the traits it defines and only use one of the others in a concrete context. Am I understanding the design correctly here?
Not for my code base. :) The changes in 2.0.0. cause HUNDREDS of compile errors because of the changes to Session.
This might not be possible with 2.0 since the table itself is no longer queryable. I will obviously have to refactor, but to suggest that the �small� differences in Slick�s 2.0 API will yield �user code stayed mostly the same� is a bit misleading :)
I'm currently unable to get the "soft insert" feature working in a test app. I'm obviously using the new 2.0.0-M3 version.
The 2.0.0-M3 documentation isn't updated regarding to this feature. I don't see any sample code that uses this.
Is this feature really in M3? Can I see a simple code snippet?
On 2013-11-08 14:22, Stefan Zeiger wrote:
Note that this is not a production-ready or beta release. The Slick Extensions package is not available for this milestone release and the Slick Examples and Slick Testkit Example projects have not been updated yet.
Updating Slick Extensions for 2.0 was less work than I expected. I just published a release for 2.0.0-M3. See http://slick.typesafe.com/doc/2.0.0-M3/extensions.html on how to add it to your project.
package code.model
import java.sql.Date
import scala.slick.driver.H2Driver.simple._
import scala.slick.collection.heterogenous._
import syntax._
class Joiners(tag: Tag) extends Table[Int :: Option[String] :: Option[String] ... :: HNil](tag, "joiner") { def id = column[Int]("id", ...
def name = column[String("name", ...
def contact = column[String("contact", ...
...
def col33 = column[String]("column33", ...
def * = id :: name :: contact ... :: HNil }