Marco,
There is a "getCommand" function that should return the data you're looking for, although I'm not sure what the output will be for 'non-command' datasources.
The getCommand function is available for the "RRDDatasource" class that is a "sub-object" of the "RRDTemplate" class. You should be able to do something like the following:
for d in dmd.Devices.getSubDevices():
for t in d.getRRDTemplates():
for ds in t.datasources():
ds.getCommand(d)
# this might also work
# print ds.command
although like I said I don't think the output will be correct for non-command data sources.
Hope this helps,
Joseph