I am trying to split a table into two and there's a need to transform the data before moving it. I am using a few plpgsql functions to achieve that.
But aerich upgrade fails with the following error:
...
File "/Users/shipra/code/.virtualenvs/venv/lib/python3.9/site-packages/asyncpg/connection.py", line 318, in execute
return await self._protocol.query(query, timeout)
File "asyncpg/protocol/protocol.pyx", line 338, in query
asyncpg.exceptions.PostgresSyntaxError: unterminated dollar-quoted string at or near "$$
-- Convert camelCase to snakecase.
BEGIN
RETURN trim(both '' from lower(regexp_replace(keyname, '([A-Z])','\1', 'g')))"
During handling of the above exception, another exception occurred:
...
File "/Users/shipra/code/.virtualenvs/venv/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 38, in translateexceptions
raise OperationalError(exc)
tortoise.exceptions.OperationalError: unterminated dollar-quoted string at or near "$$
-- Convert camelCase to snakecase.
BEGIN
RETURN trim(both '' from lower(regexp_replace(keyname, '([A-Z])','\1', 'g')))"
The function mentioned in the traceback:
CREATE OR REPLACE FUNCTION camel_to_snake(key_name TEXT) RETURNS TEXT AS $$
-- Convert camelCase to snake_case.
BEGIN
RETURN trim(both '_' from lower(regexp_replace(key_name, '([A-Z])','_\1', 'g')));
END;
$$ LANGUAGE plpgsql;
I am trying to split a table into two and there's a need to transform the data before moving it. I am using a few plpgsql functions to achieve that. But
aerich upgrade
fails with the following error:The function mentioned in the traceback: