You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@metamodel.apache.org by William Bowen <wi...@zoomdata.com> on 2017/08/01 06:34:16 UTC

Re: Index Support

Thanks Kasper, this was exactly what I needed. I understand not all sources
will support this.


*William Bowen*  Senior Software Engineer, Zoomdata
Mobile:  <+1+718+300-4574>+1 <+1+718+300-4574>571-308-6361
Email:  <bu...@zoomdata.com>william.bowen@zoomdata.com
Website: www.zoomdata.com <http://www.zoomdata.com/>
<http://www.facebook.com/Zoomdata>
<http://www.linkedin.com/company/zoomdata>  <http://twitter.com/Zoomdata>

On Mon, Jul 31, 2017 at 7:00 PM, Kasper Sørensen <
i.am.kasper.sorensen@gmail.com> wrote:

> Hi William,
>
> Yes, as long as you're just aware that what you're doing is then not
> agnostic to datastore. It is definately only going to work with
> JdbcDataContext and possibly (depending on the statement) only going to
> work with your specific DB.
>
> Here's a snippet I've used some times to do ALTER TABLE (another type of
> statement that isn't supported by MM):
>
>         public void sqlUpdate(DataContext dataContext, String sql) {
>             final JdbcDataContext jdbcDataContext = (JdbcDataContext)
> dataContext;
>             final Connection connection = jdbcDataContext.getConnection();
>             try {
>                 final Statement statement = connection.createStatement();
>                 final int sqlResult = statement.executeUpdate(sql);
>                 statement.close();
>
>                 logger.info("SQL update returned {}: {}", sqlResult, sql);
>             } catch (SQLException e) {
>                 throw new IllegalStateException("SQL update failed: " +
> sql, e);
>             } finally {
>                 jdbcDataContext.close(connection);
>             }
>         }
>
> 2017-07-31 2:23 GMT-07:00 William Bowen <wi...@zoomdata.com>:
>
>> I have a need when creating a table to specify an index on a column. I
>> can't see anything in TableCreationBuilder or ColumnCreationBuilder that
>> would do the trick.
>>
>> My fallback plan was to try to just build and execute the CREATE INDEX
>> statement myself, but the query parser complains that my query doesn't
>> start with SELECT.
>>
>> Is there a way I can create this index? Or gain access to run underlying
>> SQL to create it myself?
>>
>> Thanks,
>>
>> *William Bowen*  Senior Software Engineer, Zoomdata
>> Mobile:  <+1+718+300-4574>+1 <+1+718+300-4574>571-308-6361
>> <(571)%20308-6361>
>> Email:  <bu...@zoomdata.com>william.bowen@zoomdata.com
>> Website: www.zoomdata.com <http://www.zoomdata.com/>
>> <http://www.facebook.com/Zoomdata>
>> <http://www.linkedin.com/company/zoomdata>  <http://twitter.com/Zoomdata>
>>
>
>