Skip to content
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

Add .from_string to __repr__ #18

Open
iloveitaly opened this issue Dec 19, 2024 · 2 comments
Open

Add .from_string to __repr__ #18

iloveitaly opened this issue Dec 19, 2024 · 2 comments

Comments

@iloveitaly
Copy link

If you get an error like this:

07:57:08 py_dev.1              | [SQL: INSERT INTO visit_audio_file (id, user_id, azure_file_name) VALUES (%(id)s::UUID, %(user_id)s::UUID, %(azure_file_name)s::VARCHAR) RETURNING visit_audio_file.created_at, visit_audio_file.updated_at]
07:57:08 py_dev.1              | [parameters: {'id': UUID('0193df6c-2cca-739d-92a2-0cc4e260bc33'), 'user_id': TypeID('usr_01jf3nmnjdegsv7pm37scm12d7'), 'azure_file_name': 'user_2pB8MHVdVjSxOye98WwpMHalwlT_1734620228484_recording (1).wav'}]
07:57:08 py_dev.1              | (Background on this error at: https://sqlalche.me/e/20/f405)

You cannot copy/paste the TypeID into an ipython terminal. You need to append .from_string to the TypeID constructor.

My proposal is we either:

  1. Allow TypeID() to accept a typeid uuid.
  2. Add .from_string to the __repr__

wdyt?

@akhundMurad
Copy link
Owner

Hi. What do you mean by adding .from_string to the __repr__?

@iloveitaly
Copy link
Author

def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, str(self))

Something like:

    def __repr__(self):
        return "%s.from_string(%r)" % (self.__class__.__name__, str(self))

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

No branches or pull requests

2 participants