Skip to content

[PATCH] Fix raw SQLite template parameter dropping for distinct_id column#14

Open
GableTheSnail wants to merge 1 commit into
Maxime-J:mainfrom
GableTheSnail:main
Open

[PATCH] Fix raw SQLite template parameter dropping for distinct_id column#14
GableTheSnail wants to merge 1 commit into
Maxime-J:mainfrom
GableTheSnail:main

Conversation

@GableTheSnail

Copy link
Copy Markdown

Hello! It was a tough day figuring out why the "Distinct Id" is not filled in but all other parameters, including geo-parameters such as the Country, Region or City are filled-in more than often. I narrowed it down to an issue in translating from PostgreSql with one field being improperly named.

I fixed it in the meanwhile using a database trigger, which is very elegant to work around the issue:

CREATE TRIGGER IF NOT EXISTS force_distinct_id_sync
AFTER INSERT ON session
FOR EACH ROW
WHEN NEW.distinct_id IS NULL OR NEW.distinct_id = ''
BEGIN
    UPDATE session
    SET distinct_id = NEW.session_id
    WHERE session_id = NEW.session_id;
END;

because it only needs to be set once. After that the "Distinct Id" field started to be populated, which was great.

The patch adds a file under the patches directory to rename the parameter properly so it should work directly without any changes unless I am missing something.

Many thanks for the SQLite port, it's very lightweight and works great for me/us!

Cheers!

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

Successfully merging this pull request may close these issues.

1 participant