This is an alias I have in my bash profile which does the work of 
recreating my orientdb schema for me:

alias orientrefresh="pushd \"$SQL_FOLDER"; orientdb-console \$(echo 
\"connect remote:localhost/database admin admin;\" & cat classes.odb.sql 
properties.odb.sql indexes.odb.sql data.odb.sql); popd"

Change "$SQL_FOLDER" to your folder path or set the environment variable 
appropriately.  Modify the connect string portion appropriately.

With this technique it is very important that all lines end with semi-colon 
and line-break, including comments.  Otherwise things just don't work right 
:)

Hope this helps :)

Regards,
J5

On Monday, February 10, 2014 7:07:33 PM UTC-5, [email protected] wrote:
>
> Hi,
>
> I'm trying to automate the creation of a graph database through the use of 
> the console.sh(.bat) for various environments we have.
>
> I'd like to separate out the environment specific statements (such as 
> connect, drop database, create database) from the sql statements that load 
> the actual data. 
> I'm hoping to perform a variable substitution (gradle/groovy based) on a 
> small, generic/template sql file, and run it in combination with another 
> sql file that loads the data.
>
> For example, I'd like to run something like this:
>
> > cd $ORIENTDB_HOME/bin
> > ./console.sh recreate-db.sql load-data.sql
>
> ...where the small "recreate-db.sql" file would have a few statements for 
> connecting, dropping and creating a database. I would replace the 
> environment specific information (database name, url, user, password, 
> etc...) in the "recreate-db.sql". 
>
> I want to somehow run the configured "recreate-db.sql" script with the 
> unchanged "load-data.sql" in the same console session.
>
> Any idea how I can do this? It looks like only one .sql file may be passed 
> into the console at a time.
>
> Other options could be
>
>    - dynamically creating a string of sql that contains all my 
>    environment specific commands, followed by another command to essentially 
>    import the "load-data.sql" script
>    - setting some environment variables that I could access from the sql 
>    script passed into the console.
>    
> Thanks in advance for your help! I've been scouring this group, and the 
> orientdb documentation, trying to find a solution that doesn't require me 
> to make copies of large sql files when automating the configuration for our 
> different environments.
>
> Regards,
>
> Andrew
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to