Skip to content

Commit

Permalink
Update ui.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-osalazarlizano committed Jul 4, 2024
1 parent fb8c26c commit 5acd9df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hybrid-tables/python/src/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ def run(self):
st.dataframe(self.session.table('internal.dictionary').to_pandas(), use_container_width=True)

def add(self, key: str, value: str):
result = self.session.call('core.add_key_value', key, value)
st.write(json.loads(result))
result = json.loads(self.session.call('core.add_key_value', key, value))
if "SQLCODE" in result:
error = f"Primary key violation on Hybrid Table. **{key}** already exists." if result["SQLCODE"] == 200001 else result["SQLERRM"]
st.error(error, icon="🚨")

if __name__ == '__main__':
ui = UI(Session.builder.getOrCreate())
Expand Down

0 comments on commit 5acd9df

Please sign in to comment.