Configuration object for SQLite
| 766 | |
| 767 | |
| 768 | class SQLiteConfig: |
| 769 | |
| 770 | """Configuration object for SQLite""" |
| 771 | |
| 772 | _conf = {"host": os.environ.get("USER_MANAGED_SQLITE_HOST", "localhost"), |
| 773 | "port": os.environ.get("USER_MANAGED_SQLITE_PORT", 6333), |
| 774 | "sqlite_db_folder_path": LLMWareConfig().get_library_path(), |
| 775 | "user_name": "", |
| 776 | "pw": "", |
| 777 | "db_name": "sqlite_llmware.db", |
| 778 | # add new parameter for SQLTables |
| 779 | "db_experimental": "sqlite_experimental.db"} |
| 780 | |
| 781 | @classmethod |
| 782 | def get_config(cls, name): |
| 783 | if name in cls._conf: |
| 784 | return cls._conf[name] |
| 785 | raise ConfigKeyException(name) |
| 786 | |
| 787 | @classmethod |
| 788 | def set_config(cls, name, value): |
| 789 | cls._conf[name] = value |
| 790 | |
| 791 | @classmethod |
| 792 | def get_uri_string (cls): |
| 793 | """For SQLite the URI string is the local file with full absolute path""" |
| 794 | db_file = os.path.join(cls._conf["sqlite_db_folder_path"], cls._conf["db_name"]) |
| 795 | return db_file |
| 796 | |
| 797 | # new method for SQLTables DB |
| 798 | @classmethod |
| 799 | def get_uri_string_experimental_db(cls): |
| 800 | """For SQLite the URI string is the local file with full absolute path""" |
| 801 | db_file = os.path.join(cls._conf["sqlite_db_folder_path"], cls._conf["db_experimental"]) |
| 802 | return db_file |
| 803 | # end method |
| 804 | |
| 805 | @classmethod |
| 806 | def get_db_configs(cls): |
| 807 | configs = {} |
| 808 | for keys, values in cls._conf.items(): |
| 809 | configs.update({keys:values}) |
| 810 | return configs |
| 811 | |
| 812 | @classmethod |
| 813 | def get_user_name(cls): |
| 814 | return cls._conf["user_name"] |
| 815 | |
| 816 | @classmethod |
| 817 | def get_db_pw(cls): |
| 818 | return cls._conf["pw"] |
| 819 | |
| 820 | |
| 821 | class QdrantConfig: |
no test coverage detected