SubSonic.SqlQuery Distinct - subsonic

How do you do DISTINCT with SubSonic.SqlQuery and not Query? I am using Subsonic 2.1 and can't seem to find DISTINCT
Thanks

I don't know how to do it for ActiveRecord, but I don't think it's that much different from RepositoryRecord:
DB.Select().Distinct().From<Product>().....

DB.Select().From().Distinct().....

Related

Higher Order functions in Spark SQL query

I just got introduced to Spark SQL higher order functions transform(), filter() etc. I searched online, but couldn't find much advanced use-cases leveraging these functions.
Can anyone please explain transform() with a couple of advanced real-life use-case using sql query. Does it always need to work on nested complex types (arrays, struct etc) ? Or can it be used to process simple data-type records as well ?
Any help is appreciated.
Thanks
The following online resource vividly demonstrates in %sql mode :
https://docs.databricks.com/delta/data-transformation/higher-order-lambda-functions.html

Derby: Full Text Search

I have a gigantic data of more than 2500000000 records distributed among 10 tables in derby. There are two columns "floraNfauna" and "locations" common in each table. Now I have to find a particular "floraNfauna" found at particular "locations", so I use "select" query with "like" e.g. "select * from tables where floraNfauna like('%fish%') and locations like('%shallow water bodies%')"; and it takes days to finally fetch the results which count below 1000 sometimes. After searching I found that "full text search" would be the best and faster approach to this. Can you help me with an example?
Derby integrates nicely with Lucene, which is a full-text search engine.
Read more about that here: http://wiki.apache.org/db-derby/LuceneIntegration
Firstly you must consider indexing your table. Here is an SO link which definitely would help to know more about Why to index a DB table.
More about Adding Indexes to a table.
Secondly, if you are using a centralized database, then definitely consider upgrading your server hardware configuration.
Thanks, hope it helps.

Using Cassandra as a "schemaless NoSQL database"

I'm looking at using Cassandra for an enterprise web-site I'm working on, which could be used by up to 250 million users. Cassandra seems like an obvious choice because of the way it scales, although I was a little sad not to be able to use a schema-less database like Couch (for political reasons I won't go in to).
I've read that you can still use Cassandra like a schema-less database, using either a super-column or simply serializing objects in to normal columns. At the moment I'm using .NET for my front-end.
Are there any libraries out there already that help with using Cassandra in this way?
Has anyone done anything like this already using .NET? Any tips?
Any advice gratefully received!
Thanks,
Steve.
Datomic is schemaless. Attributes are modeled and generic objects can be created, saved, queried with any combination of attributes.
http://www.datomic.com
http://docs.datomic.com/storage.html#cassandra

Range scans on columns using Astyanax

My column family stores data in the column names and I want to perform range query on the columns using Astyanax. Can anyone suggest how to do that?
There are lots example on range query available here
Sample one
keyspace.prepareQuery(CF_TIME_UUID)
.getKey(rowKey)
.withColumnRange(
new RangeBuilder()
.setLimit(10)
.setStart(TimeUUIDUtils.getTimeUUID(0))
.setEnd(TimeUUIDUtils
.getTimeUUID(Long.MAX_VALUE >> 8))
.build()).execute();
I agree with abhi and this is exactly how Playorm has implemented it. You may see the code of columnSlice() API at https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/cassandra/CassandraSession.java
Also, if you are using Playorm for Cassandra you can just use its ColumnSlice API. The example is given at https://github.com/deanhiller/playorm/blob/master/src/test/java/com/alvazan/test/TestColumnSlice.java
Actually, you could just use PlayOrm Query language as well if you final goal is getting the entities out.

How to perform join using LINQ for NHibernate

Can i join two tables using LINQ for NHibernate like I can do in LINQ To SQL?
ok, i got some weird tag for having this question un-answered! so im gonna post an answer myself :) . the thing is LINQ to Nhibernate is not mature enough to handle this. Hopefully it will be available in a next release.
This question was from several years ago.
I just wanted to note for anyone running across it that you can do joins with linq and it works. Also if you set up the relationships in the models you often don't even need to specify the join, nHibernate works it out from the fields you are projecting into the resultset.

Resources