Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Feature Request: Add support for using uuids as primary keys. #127

Open
byronformwalt opened this issue Dec 17, 2016 · 12 comments
Open

Feature Request: Add support for using uuids as primary keys. #127

byronformwalt opened this issue Dec 17, 2016 · 12 comments

Comments

@byronformwalt
Copy link

I just discovered Orator last night. I'm a Rubyist that needs to mingle Python3 and Ruby in a project with a shared PostgreSQL database hosted locally. I use uuids as primary keys in the database. I haven't found a way to do this, so I am opening a feature request. Also, I haven't been able to find a discussion forum for Orator. Does one exist yet?

@byronformwalt
Copy link
Author

byronformwalt commented Dec 17, 2016

It looks like addition of this type would need to be included in the body of the following method:
orator.dbal.PostgresSchemaManager._get_portable_table_column_definition() which is defined in dbal/postgres_schema_manager.py.

The following source files look as though they may also require modification:

@sdispater
Copy link
Owner

There is a Slack for Orator. So if you want to to be added to it drop me a DM on twitter with your email address and I will gladly do it.

Regarding UUIDs in Orator, if you only need to read and write to the database, you can easily do it since UUIDs can be inserted and retrieved as strings.

Now, if you want to create a column with the UUID type from Orator this is not currently supported but I will see if I can add it.

@byronformwalt
Copy link
Author

byronformwalt commented Dec 18, 2016 via email

@sdispater
Copy link
Owner

I am not sure I understand. What's the type of your column in PostgreSQL?

@byronformwalt
Copy link
Author

byronformwalt commented Dec 18, 2016 via email

@sdispater
Copy link
Owner

So, yes, you can pass a string to Orator as your ID and it will automatically be converted to a uuid. If you have a binary uuid column you can also pass a string and it should work.

@byronformwalt
Copy link
Author

byronformwalt commented Dec 18, 2016 via email

@sdispater
Copy link
Owner

Okay. I understand now, sorry for being so slow. So, you are right it's not possible to create a uuid type from the schema builder without making it database backend dependent.

I will look into it but, as you said, it will not be trivial.

And, thanks for the kind words, I really appreciate it 😃

@pinge
Copy link

pinge commented Feb 2, 2017

+1

@inventionlabsSydney
Copy link

I know it's a rough start but for use in my internal projects I implemented postgres uuid and overrode default to detect a gen_random_uuid() and not encapsulate it as a string. You can see the branch here: https://github.com/inventionlabsSydney/orator/tree/feature/PostgresGrammarSupportUuid

I'd like @sdispater if you could provide me a list of things to do in order that we could merge this support into the actual project.
I completely don't think the override I have currently in place is a long term solution...

@inventionlabsSydney
Copy link

PR in: #261

@bjorntheart
Copy link

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants