-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Adding parent_table_map/version_table_map #286
Labels
Comments
Having a I have created something like this in my own projects: from sqlalchemy_continuum import versioning_manager, parent_class
def parent_table(table):
if table in versioning_manager.association_version_tables:
parent_table = next(
iter(
t
for t in versioning_manager.association_tables
if versioning_manager.options['table_name'] % t.name == table.name
),
None,
)
return parent_table
parent_table = next(
iter(
parent_class(m).__table__
for m in versioning_manager.version_class_map
if m.__table__ == table
),
None,
)
return parent_table |
@marksteward I was hoping to create a PR for this - if there is interest on your side I can think of 2 approaches here:
I feel solution 2 is a bit better and more consistent with What would you recommend ? |
indiVar0508
added a commit
to indiVar0508/sqlalchemy-continuum
that referenced
this issue
Sep 11, 2022
indiVar0508
added a commit
to indiVar0508/sqlalchemy-continuum
that referenced
this issue
Sep 11, 2022
indiVar0508
added a commit
to indiVar0508/sqlalchemy-continuum
that referenced
this issue
Sep 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been using the variables:
parent_class_map
version_class_map
association_tables
association_version_tables
A lot.
And they helps me to use sqla-continuum effectively for various logic I need for my application.
But recently I came across a case where I was doing:
But with sqla-continuum, I wanted to be able to change it to:
I couldn't find any good way to figure out this mapping
The text was updated successfully, but these errors were encountered: