Compare two schemas of two different DB's using Diff
598 views
Skip to first unread message
Neethu Abhinav
unread,
May 22, 2018, 7:03:34 AM5/22/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlalchemy
Hi,
I have installed sqlalchemy 1.2.7, and went through the docs for sqlAlchemy Diff, but i am still confused on how to use it effectively for my requirement.
We use Oracle 12C
1. We have two databases, which have the schema in common, DB1 Schema A, DB2 Schema A
2. I want to compare these two schemas across db's to get the difference in the metadata.(eg: difference in Table columns, missing index and so on).
3. Are these possible?
4. And in the documentation, it is mentioned to use compare(uri_left, uri_right), what are these uri's and how to use them or rather create them. Please guide me through this.
Thanks,
Neethu
Simon King
unread,
May 22, 2018, 7:18:29 AM5/22/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlalchemy
Yes, that's the tool i am talking about
oh okay, so ideally if i pass my two connections, it will get me a difference at the whole DB level and from the result, i can segregate what i need? Sorry if i sound ignorant, i am totally new to SQLAlchemy.
Thanks,
Neethu
Neethu Abhinav
unread,
May 22, 2018, 7:26:11 AM5/22/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlalchemy
And can you also help me the imports, that is required to use this tool?
Simon King
unread,
May 22, 2018, 8:28:07 AM5/22/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlal...@googlegroups.com
(Note that sqlalchemy-diff is not part of sqlalchemy, it's a tool
built on top of it, and there may not be anyone on this list who has
ever used it)
Something like this might do what you want:
########################################
from pprint import pprint
from sqlalchemydiff import compare
result = compare(DBURI1, DBURI2)
if result.is_match:
print('Databases are identical')
else:
print('Databases are different')
pprint(result.errors)
########################################