- **Migration to uv package manager**: Replace pip/requirements with modern pyproject.toml - Add pyproject.toml with complete dependency management - Update all scripts and Makefile to use uv commands - Maintain backward compatibility with existing workflows - **PostgreSQL integration and migration tools**: - Enhanced config.py with automatic password URL encoding - Complete PostgreSQL setup scripts and documentation - High-performance SQLite to PostgreSQL migration tool (91x speed improvement) - Support for both connection strings and individual components - **Executable distribution system**: - PyInstaller integration for standalone .exe creation - Automated build scripts with batch file generation - Complete packaging system for end-user distribution - **Enhanced data management**: - Fix --fill-gaps command with proper method implementation - Add gap detection and historical data backfill capabilities - Implement data update functionality for existing records - Add comprehensive database adapter methods - **Developer experience improvements**: - Password encoding tools for special characters - Interactive setup wizards for PostgreSQL configuration - Comprehensive documentation and migration guides - Automated testing and validation tools 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Password URL encoder for PostgreSQL connection strings
|
|
"""
|
|
|
|
import urllib.parse
|
|
import sys
|
|
|
|
def encode_password(password: str) -> str:
|
|
"""URL encode a password for use in connection strings"""
|
|
return urllib.parse.quote(password, safe='')
|
|
|
|
def build_connection_string(username: str, password: str, host: str, port: int, database: str) -> str:
|
|
"""Build a properly encoded PostgreSQL connection string"""
|
|
encoded_password = encode_password(password)
|
|
return f"postgresql://{username}:{encoded_password}@{host}:{port}/{database}"
|
|
|
|
def main():
|
|
print("PostgreSQL Password URL Encoder")
|
|
print("=" * 40)
|
|
|
|
if len(sys.argv) > 1:
|
|
# Password provided as argument
|
|
password = sys.argv[1]
|
|
else:
|
|
# Interactive mode
|
|
password = input("Enter your password: ")
|
|
|
|
encoded = encode_password(password)
|
|
|
|
print(f"\nOriginal password: {password}")
|
|
print(f"URL encoded: {encoded}")
|
|
|
|
# Optional: build full connection string
|
|
try:
|
|
build_full = input("\nBuild full connection string? (y/N): ").strip().lower() == 'y'
|
|
except (EOFError, KeyboardInterrupt):
|
|
print("\nDone!")
|
|
return
|
|
|
|
if build_full:
|
|
username = input("Username: ").strip()
|
|
host = input("Host: ").strip()
|
|
port = input("Port [5432]: ").strip() or "5432"
|
|
database = input("Database [water_monitoring]: ").strip() or "water_monitoring"
|
|
|
|
connection_string = build_connection_string(username, password, host, int(port), database)
|
|
|
|
print(f"\nComplete connection string:")
|
|
print(f"POSTGRES_CONNECTION_STRING={connection_string}")
|
|
|
|
print(f"\nAdd this to your .env file:")
|
|
print(f"DB_TYPE=postgresql")
|
|
print(f"POSTGRES_CONNECTION_STRING={connection_string}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |