Untitled
unknown
python
2 years ago
816 B
18
Indexable
from datetime import datetime
import uuid
# Function to generate unique ID
def generate_unique_id(prefix):
unique_code = uuid.uuid4().hex[:6] # Generate a unique 6-character hexadecimal code
today = datetime.today().strftime('%Y%m%d')
return f"{prefix}{today}{unique_code}"
# Main function
def main():
# Title
st.title("Automatic ID Generator and Data Loader")
# Dropdown for selecting prefix
prefix_options = ['Software', 'Hardware', 'Others']
prefix = st.selectbox('Select Prefix:', prefix_options)
# Submit button
if st.button('Submit'):
generated_id = generate_unique_id(prefix[0])
st.write(f"ID nr {generated_id} was generated. Data were loaded into Snowflake.")
# Run the main function
if __name__ == "__main__":
main()Editor is loading...
Leave a Comment