Conceptually, what I’m trying to do is:

  1)  Enable queries for a higher level type (e.g. Node) to return all 
direct instances and sub-class instances (e.g. Node, [Servers, [UnixType, 
[Linux, AIX]]])

  2)  Enable a set of attributes to be inherited by all sub-types

  3)  Enable an attribute update at any level to update attributes seen by 
all levels (e.g. time_updated in my example)

 

1 and 2 above “just work” by setting up SqlAlchemy with join inheritance.  
But I’ve failed to implement #3.  

 

Versions:  Python v3.6.1, SQLAlchemy v1.1.11, and Postgres v9.6.


Class definitions follow...

class Node(Base):

__tablename__ = 'node'

hostname = Column(String(256), primary_key=True)

domain = Column(String(256), primary_key=True)

object_id = Column(CHAR(32), unique=True, default=lambda :uuid.uuid4().hex)

object_type = Column(String(16))

time_created = Column(DateTime(timezone=True), server_default=func.now())

time_updated = Column(DateTime(timezone=True), default=func.now(), 
onupdate=func.now())

description  = Column(String(256))

__mapper_args__ = {'with_polymorphic': '*', 'polymorphic_identity':'node', 
'polymorphic_on':object_type}


class Server(Node):

__tablename__ = 'server'

object_id = Column(None, ForeignKey(Node.object_id), primary_key=True)

related_application = Column(String(512), nullable=True)

__mapper_args__ = {'with_polymorphic': '*', 
'polymorphic_identity':'server', 'inherit_condition': object_id == 
Node.object_id}


class UnixType(Server):

__tablename__ = 'unix_type'

object_id = Column(None, ForeignKey(Server.object_id), primary_key=True)

__mapper_args__ = {'polymorphic_identity':'node_windows', 
'with_polymorphic': '*', 'inherit_condition': object_id == Server.object_id}


class Linux(UnixType):

__tablename__ = 'linux'

object_id = Column(None, ForeignKey(UnixType.object_id), primary_key=True)

distribution = Column(String(256), nullable=True)

__mapper_args__ = {'with_polymorphic': '*', 'polymorphic_identity':'linux', 
'inherit_condition': object_id == UnixType.object_id}


class AIX(UnixType):

__tablename__ = 'aix'

object_id = Column(None, ForeignKey(UnixType.object_id), primary_key=True)

distribution = Column(String(256), nullable=True)

__mapper_args__ = {'with_polymorphic': '*', 'polymorphic_identity':'aix', 
'inherit_condition': object_id == UnixType.object_id}


 

I’d like my app to query the base class (Node) for either the two primary 
keys (hostname and domain) or the unique key (object_id), and then be able 
to directly update any attribute on all inherited class levels.  Right now 
I’m having to query for Node, then query the Linux class for the same ID 
(to get access to all the attributes for my update), then update.  And that 
works ok unless I want automated actions on an inherited attribute – like 
the last update time (time_update).  It only updates when I specifically 
update the class with that attribute (the Node class in my example).

 

Complete script from my last iteration attached, along with sample output.

 

In my four iterations of test cases (required to show updates at all 
levels), I show the following:

  1)  Create a base type instance at the start, that can be sub-typed to a 
more qualified subtype later (e.g. create Node instance, later sub-type 
into AIX instance). I’m doing this by copy/delete/recreate-as-sub-type 
which works ok now; I am assuming there is a better way.

  2)  Create a more qualified type at the start, and send updates for just 
the base type (e.g. create AIX instance at the start, later update the 
“related_application” on the Server instance, or the “time_updated” on the 
Node instance)

 

Samples show that the time_update attribute only changes when the base 
class changes.

 

I probably could update a Linux or AIX object, then re-query for its base 
Node with the same ID, and then force a manual update on the timestamp.  
Hoping there is another way.

 

Sorry for the verbosity; I tried to be comprehensive.  Appreciate your help.

 

 

===============================================

Additional detail (probably unnecessary) – hence listing it last:

I’ve spent about a week spinning my wheels, so I’m reaching out.  I’ve 
tried different variations from web posts, including: 

• relationships from parent-to-child and vice versa (to event off of in 
order to propagate time_updated; hit different problems and gave up with 
circular dependency on deletes)

• with_polymorphic in the query and attributes (to load all attributes 
types so I could set in just one level)

• duplicated attribute with foreign keys in all classes (and specifying 
inherit_condition - trying to get foreign keys to point to the same 
time_updated attribute in the base class)

• a mixin object to use declared_attr.cascading on forign keys

 

Perhaps one of those is the right way to do this, but I can’t figure it 
out.  Some posts show solutions without join inheritance, and I can’t seem 
to retrofit those solutions due to the foreign key magic.  Most inheritance 
posts show only 2-levels deep but the same solution doesn’t seem to work 
with my model starting at 4-levels deep.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
import datetime, sys, traceback, logging, os, uuid
from time import sleep
from sqlalchemy import Column, ForeignKey, String, DateTime
from sqlalchemy.sql import func
from sqlalchemy.ext.declarative import declarative_base, declared_attr, has_inherited_table
from sqlalchemy.types import CHAR
from sqlalchemy import inspect, create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, with_polymorphic, relationship
Base = declarative_base()

class Node(Base):
	__tablename__ = 'node'
	hostname = Column(String(256), primary_key=True)
	domain = Column(String(256), primary_key=True)
	object_id = Column(CHAR(32), unique=True, default=lambda :uuid.uuid4().hex)
	object_type = Column(String(16))
	time_created = Column(DateTime(timezone=True), server_default=func.now())
	time_updated = Column(DateTime(timezone=True), default=func.now(), onupdate=func.now())
	description  = Column(String(256))
	__mapper_args__ = {'with_polymorphic': '*',
					   'polymorphic_identity':'node',
					   'polymorphic_on':object_type}

class Server(Node):
	__tablename__ = 'server'
	object_id = Column(None, ForeignKey(Node.object_id), primary_key=True)
	related_application = Column(String(512), nullable=True)
	__mapper_args__ = {'with_polymorphic': '*',
					   'polymorphic_identity':'server',
					   'inherit_condition': object_id == Node.object_id}

class UnixType(Server):
	__tablename__ = 'unix_type'
	object_id = Column(None, ForeignKey(Server.object_id), primary_key=True)
	__mapper_args__ = {'polymorphic_identity':'node_windows', 'with_polymorphic': '*', 'inherit_condition': object_id == Server.object_id}

class Linux(UnixType):
	__tablename__ = 'linux'
	object_id = Column(None, ForeignKey(UnixType.object_id), primary_key=True)
	distribution = Column(String(256), nullable=True)
	__mapper_args__ = {'with_polymorphic': '*',
					   'polymorphic_identity':'linux',
					   'inherit_condition': object_id == UnixType.object_id}

class AIX(UnixType):
	__tablename__ = 'aix'
	object_id = Column(None, ForeignKey(UnixType.object_id), primary_key=True)
	distribution = Column(String(256), nullable=True)
	__mapper_args__ = {'with_polymorphic': '*',
					   'polymorphic_identity':'aix',
					   'inherit_condition': object_id == UnixType.object_id}

def createNode(hostname, domain, osType, attrDict):
	nodeObject = None
	if osType is None:
		nodeObject = Node(hostname=hostname, domain=domain)
	elif osType == 'AIX':
		nodeObject = AIX(hostname=hostname, domain=domain)
	elif osType == 'Linux':
		nodeObject = Linux(hostname=hostname, domain=domain)
	if nodeObject is not None:
		for attr in attrDict.keys():
			setattr(nodeObject, attr, attrDict[attr])
	return nodeObject

def deleteParentNodeAndRecreateChildNode(session, copyNode, existingNode, osType, attrDict):
	copyNode = None
	if osType == 'AIX':
		copyNode = AIX()
	elif osType == 'Linux':
		copyNode = Linux()
	for attr in inspect(Node).attrs:
		if attr.key not in ['object_type', 'node']:
			attrValue = getattr(existingNode, attr.key)
			if attrValue is not None:
				setattr(copyNode, attr.key, attrValue) 
	## Delete/recreate to preserve data, yet gain access to subclass attributes
	session.delete(existingNode)
	session.commit()
	## add child-specific data
	for attr in attrDict.keys():
		setattr(copyNode, attr, attrDict[attr])
		print('  -- attr: {}={}'.format(attr, attrDict[attr]))
	session.add(copyNode)
	session.commit()
	return copyNode

def updateNode(session, copyNode, osType, attrDict):
	if osType is None:
		copyNode = session.query(Node).filter(Node.object_id == copyNode.object_id).first()
	elif osType == 'AIX':
		copyNode = session.query(AIX).filter(AIX.object_id == copyNode.object_id).first()
	elif osType == 'Linux':
		copyNode = session.query(with_polymorphic(Linux, '*')).filter(Linux.object_id == copyNode.object_id).first()
	for attr in attrDict.keys():
		setattr(copyNode, attr, attrDict[attr])
	session.add(copyNode)
	session.commit()
	return copyNode

def insertOrUpdate(session, hostname, domain, osType, attrDict):
	existingNode = session.query(Node).filter(Node.hostname == hostname, Node.domain == domain).first()
	if existingNode is None:
		try:
			thisNode = createNode(hostname, domain, osType, attrDict)
			session.add(thisNode)
			session.commit()
			print('Inserted object: {}@{} with id[{}] type [{}] attrDict [{}] '.format(hostname, domain, thisNode.object_id, thisNode.object_type, attrDict))
		except:
			stacktrace = traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])
			print('Failure in INSERT: {}'.format(str(stacktrace)))
			session.rollback()
	else:
		copyNode = existingNode
		try:
			if (existingNode.object_type == 'node' and osType is not None):
				copyNode = deleteParentNodeAndRecreateChildNode(session, copyNode, existingNode, osType, attrDict)
			else:
				copyNode = updateNode(session, copyNode, osType, attrDict)
			print('Updated object: {}@{} with id[{}] type [{}] attrDict [{}] '.format(hostname, domain, copyNode.object_id, copyNode.object_type, attrDict))
		except:
			stacktrace = traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])
			print('Failure in UPDATE: {}'.format(str(stacktrace)))
			session.rollback()

def printResults():
	for thisType in ['Node','Server','UnixType','Linux']:
		print('\n{}: headers:'.format(thisType))
		nodeAttrs = inspect(eval(thisType)).attrs
		printedHeader = False
		for node in eval(thisType).query.all():
			results = []
			header = []
			for attr in nodeAttrs:
				header.append(attr.key)
				results.append(str(getattr(node, attr.key)))
			if not printedHeader:
				print('{}\n---------------------------------------------------------------------------------------------'.format(header))
				printedHeader = True
			print(results)

def main():
	try:
		engine = create_engine('postgresql://{}:{}@{}:{}/{}'.format('platform_admin', 'GuessMe', '192.168.121.142', 5431, 'OpenContentPlatform'))
		engine.execute('drop schema if exists public cascade')
		engine.execute('create schema public')
		session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
		Base.query = session.query_property()
		Base.metadata.create_all(bind=engine)
		
		## Insert four objects
		print('\nInitial inserts\n-----------------------------')
		insertOrUpdate(session, 'server1', 'domain.com', None, dict())
		insertOrUpdate(session, 'server2', 'domain.com', None, dict())
		insertOrUpdate(session, 'server3', 'domain.com', 'Linux', dict(distribution='Fedora'))
		insertOrUpdate(session, 'server4', 'domain.com', 'AIX', dict(distribution='6.1'))
		printResults()
		sleep(1)
		
		## Update attribute on Linux/AIX
		print('\n\nSleep 1 second\nUpdate (Linux/AIX).distribution\n-----------------------------')
		insertOrUpdate(session, 'server1', 'domain.com', None, dict())
		insertOrUpdate(session, 'server2', 'domain.com', 'Linux', dict())
		insertOrUpdate(session, 'server3', 'domain.com', 'Linux', dict(distribution='Fedora release 7 (Moonshine)'))
		insertOrUpdate(session, 'server4', 'domain.com', 'AIX', dict(distribution='7.2'))
		printResults()
		sleep(1)
		
		## Update attribute on Server
		print('\n\nSleep 1 second\nUpdate Server.related_application\n-----------------------------')
		#insertOrUpdate(session, 'server1', 'domain.com', None, dict(related_application='NA'))
		insertOrUpdate(session, 'server2', 'domain.com', 'Linux', dict(related_application='App A'))
		insertOrUpdate(session, 'server3', 'domain.com', 'Linux', dict(related_application='App B'))
		insertOrUpdate(session, 'server4', 'domain.com', 'AIX', dict(related_application='App B'))
		printResults()
		sleep(1)
		
		## Update attribute on Node - now the time_update will change
		print('\n\nSleep 1 second\nUpdate Node.description\n-----------------------------')
		insertOrUpdate(session, 'server1', 'domain.com', None, dict(description='NA'))
		insertOrUpdate(session, 'server2', 'domain.com', 'Linux', dict(description='server'))
		insertOrUpdate(session, 'server3', 'domain.com', 'Linux', dict(description='server'))
		insertOrUpdate(session, 'server4', 'domain.com', 'Windows', dict(description='server'))
		printResults()

		session.remove()
		engine.dispose()
	except:
		stacktrace = traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])
		print('Failure in main: {}'.format(stacktrace))

if __name__ == "__main__":
	sys.exit(main())

Initial inserts
-----------------------------
Inserted object: serv...@domain.com with id[3abd024ee149434b854a9a3e2044b066] 
type [node] attrDict [{}] 
Inserted object: serv...@domain.com with id[89685671098044adb28758499536d73d] 
type [node] attrDict [{}] 
Inserted object: serv...@domain.com with id[bc2fbc9013374012908f2b2fb52e86b8] 
type [linux] attrDict [{'distribution': 'Fedora'}] 
Inserted object: serv...@domain.com with id[0767e5686b2344c4b6f28ae7c30efb50] 
type [aix] attrDict [{'distribution': '6.1'}] 

Node: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'node', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None']
['server1', 'domain.com', '3abd024ee149434b854a9a3e2044b066', 'node', 
'2017-07-31 15:03:59.509609-05:00', '2017-07-31 15:03:59.509609-05:00', 'None']

Server: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'None']

UnixType: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'None']

Linux: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application', 'distribution']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None', 'Fedora']


Sleep 1 second
Update (Linux/AIX).distribution
-----------------------------
Updated object: serv...@domain.com with id[3abd024ee149434b854a9a3e2044b066] 
type [node] attrDict [{}] 
Updated object: serv...@domain.com with id[89685671098044adb28758499536d73d] 
type [linux] attrDict [{}] 
Updated object: serv...@domain.com with id[bc2fbc9013374012908f2b2fb52e86b8] 
type [linux] attrDict [{'distribution': 'Fedora release 7 (Moonshine)'}] 
Updated object: serv...@domain.com with id[0767e5686b2344c4b6f28ae7c30efb50] 
type [aix] attrDict [{'distribution': '7.2'}] 

Node: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None']
['server1', 'domain.com', '3abd024ee149434b854a9a3e2044b066', 'node', 
'2017-07-31 15:03:59.509609-05:00', '2017-07-31 15:03:59.509609-05:00', 'None']

Server: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'None']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'None']

UnixType: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'None']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'None']

Linux: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application', 'distribution']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'None', 'Fedora release 7 (Moonshine)']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'None', 'None']


Sleep 1 second
Update Server.related_application
-----------------------------
Updated object: serv...@domain.com with id[89685671098044adb28758499536d73d] 
type [linux] attrDict [{'related_application': 'App A'}] 
Updated object: serv...@domain.com with id[bc2fbc9013374012908f2b2fb52e86b8] 
type [linux] attrDict [{'related_application': 'App B'}] 
Updated object: serv...@domain.com with id[0767e5686b2344c4b6f28ae7c30efb50] 
type [aix] attrDict [{'related_application': 'App B'}] 

Node: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None']
['server1', 'domain.com', '3abd024ee149434b854a9a3e2044b066', 'node', 
'2017-07-31 15:03:59.509609-05:00', '2017-07-31 15:03:59.509609-05:00', 'None']

Server: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'App B']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'App B']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'App A']

UnixType: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'App B']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:03:59.560725-05:00', 'None', 
'App B']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'App A']

Linux: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application', 'distribution']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:03:59.540842-05:00', 'None', 
'App B', 'Fedora release 7 (Moonshine)']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:03:59.528062-05:00', 'None', 
'App A', 'None']


Sleep 1 second
Update Node.description
-----------------------------
Updated object: serv...@domain.com with id[3abd024ee149434b854a9a3e2044b066] 
type [node] attrDict [{'description': 'NA'}] 
Updated object: serv...@domain.com with id[89685671098044adb28758499536d73d] 
type [linux] attrDict [{'description': 'server'}] 
Updated object: serv...@domain.com with id[bc2fbc9013374012908f2b2fb52e86b8] 
type [linux] attrDict [{'description': 'server'}] 
Updated object: serv...@domain.com with id[0767e5686b2344c4b6f28ae7c30efb50] 
type [aix] attrDict [{'description': 'server'}] 

Node: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:04:02.817854-05:00', 
'server']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:04:02.832807-05:00', 
'server']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:04:02.800787-05:00', 
'server']
['server1', 'domain.com', '3abd024ee149434b854a9a3e2044b066', 'node', 
'2017-07-31 15:03:59.509609-05:00', '2017-07-31 15:04:01.744029-05:00', 'NA']

Server: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:04:02.817854-05:00', 
'server', 'App B']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:04:02.832807-05:00', 
'server', 'App B']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:04:02.800787-05:00', 
'server', 'App A']

UnixType: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:04:02.817854-05:00', 
'server', 'App B']
['server4', 'domain.com', '0767e5686b2344c4b6f28ae7c30efb50', 'aix', 
'2017-07-31 15:03:59.560725-05:00', '2017-07-31 15:04:02.832807-05:00', 
'server', 'App B']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:04:02.800787-05:00', 
'server', 'App A']

Linux: headers:
['hostname', 'domain', 'object_id', 'object_type', 'time_created', 
'time_updated', 'description', 'related_application', 'distribution']
---------------------------------------------------------------------------------------------
['server3', 'domain.com', 'bc2fbc9013374012908f2b2fb52e86b8', 'linux', 
'2017-07-31 15:03:59.540842-05:00', '2017-07-31 15:04:02.817854-05:00', 
'server', 'App B', 'Fedora release 7 (Moonshine)']
['server2', 'domain.com', '89685671098044adb28758499536d73d', 'linux', 
'2017-07-31 15:03:59.528062-05:00', '2017-07-31 15:04:02.800787-05:00', 
'server', 'App A', 'None']

Reply via email to