-
Notifications
You must be signed in to change notification settings - Fork 16
Python API
Dmitry Romanov edited this page Nov 17, 2015
·
17 revisions
#Python API
Since ccdb command is actually written in python, there are at least 2 ways to interact with CCDB using python.
-
Using functions that very resembles 'ccdb' command
-
Using so called low level python API
It looks like this:
context.process_command_line("mkdir /test/testable2 x y z #Some comment")
Procs:
- As simple as ccdb command but you get exceptions and don't have to use syscall
- Documentation from ccdb command works here too
- It is safe
Cons:
- You don't get results as python objects. So you can't read tables and do
for
on them
Procs:
- Full access to CCDB data through python
- Working with python objects
- SQLAlchemy querries to DB is possible
Cons:
- More complex
- One can screw up data layout especially on delete operations (so please, follow instructions and examples, make backups!)