Question

EDIT: I got it working, I went into the pycassa directory and typed python pycassaShell but the 2nd part of my question (at the bottom there) is still valid: how do I run a script in pycassaShell?

I recently installed Cassandra and pycassa and followed the instruction from here.

They work fine, except I cant get pycassaShell to load. When I type pycassaShell at the command prompt, I get

'pycassaShell' is not recognized as an internal or external command, 
operable program or batch file.

Do I need to set up a path for it?

Also, does anyone know if you can run ddl scripts using pycassaShell? It is for this reason that I want to try it out. At the moment, I'm doing all my ddl in the cassandra CLI, I'd like to be able to put it in a script to automate it.

Was it helpful?

Solution

You probably don't want to be running scripts with pycassaShell. It's designed more as an interactive environment to quickly try things out. For serious scripts, I recommend just writing a normal python script that imports pycassa and sets up the connection pool and column families itself; it should only be an extra 5 or so lines.

However, there is an (undocumented, I just noticed) optional -f or --file flag that you can use. It will essentially run execfile() on that script after startup completes, so you can use the SYSTEM_MANAGER and CF variables that are already set up in your script. This is intended primarily to be used as a prep script for your environment, similar to how you might use a .bashrc file (I don't know of a Windows equivalent).

Regarding DDL statements, I suggest you look at the SystemManager class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top