databao-context-engine 0.1.5__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/PKG-INFO +1 -1
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/pyproject.toml +1 -1
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/__init__.py +7 -1
- databao_context_engine-0.1.7/src/databao_context_engine/cli/info.py +36 -0
- databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt/dbt_chunker.py +47 -0
- databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt/dbt_context_extractor.py +212 -0
- databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt/dbt_plugin.py +25 -0
- databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt/types.py +73 -0
- databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt/types_artifacts.py +77 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/plugin_loader.py +2 -1
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/info.py +14 -9
- databao_context_engine-0.1.7/src/databao_context_engine/templating/__init__.py +0 -0
- databao_context_engine-0.1.5/src/databao_context_engine/cli/info.py +0 -33
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/README.md +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/build_runner.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/build_service.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/build_wiring.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/export_results.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/build_sources/plugin_execution.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/cli/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/cli/add_datasource_config.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/cli/commands.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/cli/datasources.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/config/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/config/log_config.yaml +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/config/logging.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/databao_context_engine.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/databao_context_project_manager.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/datasources/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/datasources/check_config.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/datasources/datasource_context.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/datasources/datasource_discovery.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/datasources/types.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/event_journal/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/event_journal/writer.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/generate_configs_schemas.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/init_project.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/introspection/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/introspection/property_extract.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/api.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/config.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/descriptions/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/descriptions/ollama.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/descriptions/provider.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/embeddings/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/embeddings/ollama.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/embeddings/provider.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/errors.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/factory.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/install.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/runtime.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/service.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/main.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/mcp/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/mcp/mcp_runner.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/mcp/mcp_server.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugin_loader.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/pluginlib/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/pluginlib/build_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/pluginlib/config.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/pluginlib/plugin_utils.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/athena/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/athena/athena_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/athena/athena_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/base_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/base_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/clickhouse/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/clickhouse/clickhouse_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/clickhouse/clickhouse_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/database_chunker.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/databases_types.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/duckdb/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/duckdb/duckdb_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/duckdb/duckdb_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/introspection_model_builder.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/introspection_scope.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/introspection_scope_matcher.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mssql/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mssql/mssql_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mssql/mssql_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mysql/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mysql/mysql_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/mysql/mysql_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/postgresql/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/postgresql/postgresql_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/postgresql/postgresql_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/snowflake/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/snowflake/snowflake_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/snowflake/snowflake_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/sqlite/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/sqlite/sqlite_db_plugin.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/databases/sqlite/sqlite_introspector.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/plugins/files → databao_context_engine-0.1.7/src/databao_context_engine/plugins/dbt}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/duckdb_tools.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/plugins/resources → databao_context_engine-0.1.7/src/databao_context_engine/plugins/files}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/files/unstructured_files_plugin.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/project → databao_context_engine-0.1.7/src/databao_context_engine/plugins/resources}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/resources/parquet_chunker.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/resources/parquet_introspector.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/plugins/resources/parquet_plugin.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/serialization → databao_context_engine-0.1.7/src/databao_context_engine/project}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/init_project.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/layout.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/project_config.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/resources/examples/src/databases/example_postgres.yaml +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/resources/examples/src/files/documentation.md +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/project/resources/examples/src/files/notes.txt +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/retrieve_embeddings/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/retrieve_embeddings/retrieve_runner.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/retrieve_embeddings/retrieve_service.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/retrieve_embeddings/retrieve_wiring.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/services → databao_context_engine-0.1.7/src/databao_context_engine/serialization}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/serialization/yaml.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/storage → databao_context_engine-0.1.7/src/databao_context_engine/services}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/chunk_embedding_service.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/embedding_shard_resolver.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/factories.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/models.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/persistence_service.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/services/table_name_policy.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/storage/exceptions → databao_context_engine-0.1.7/src/databao_context_engine/storage}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/connection.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/storage/repositories → databao_context_engine-0.1.7/src/databao_context_engine/storage/exceptions}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/exceptions/exceptions.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/migrate.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/migrations/V01__init.sql +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/models.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/system → databao_context_engine-0.1.7/src/databao_context_engine/storage/repositories}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/repositories/chunk_repository.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/repositories/embedding_model_registry_repository.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/repositories/embedding_repository.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/repositories/factories.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/repositories/vector_search_repository.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/storage/transaction.py +0 -0
- {databao_context_engine-0.1.5/src/databao_context_engine/templating → databao_context_engine-0.1.7/src/databao_context_engine/system}/__init__.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/system/properties.py +0 -0
- {databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/templating/renderer.py +0 -0
{databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/__init__.py
RENAMED
|
@@ -23,7 +23,12 @@ from databao_context_engine.pluginlib.build_plugin import (
|
|
|
23
23
|
DatasourceType,
|
|
24
24
|
)
|
|
25
25
|
from databao_context_engine.pluginlib.config import ConfigPropertyDefinition
|
|
26
|
-
from databao_context_engine.project.info import
|
|
26
|
+
from databao_context_engine.project.info import (
|
|
27
|
+
DceInfo,
|
|
28
|
+
DceProjectInfo,
|
|
29
|
+
get_databao_context_engine_info,
|
|
30
|
+
get_databao_context_engine_project_info,
|
|
31
|
+
)
|
|
27
32
|
from databao_context_engine.project.init_project import InitErrorReason, InitProjectError
|
|
28
33
|
from databao_context_engine.services.chunk_embedding_service import ChunkEmbeddingMode
|
|
29
34
|
|
|
@@ -41,6 +46,7 @@ __all__ = [
|
|
|
41
46
|
"DatasourceConfigFile",
|
|
42
47
|
"DatasourceType",
|
|
43
48
|
"get_databao_context_engine_info",
|
|
49
|
+
"get_databao_context_engine_project_info",
|
|
44
50
|
"DceInfo",
|
|
45
51
|
"DceProjectInfo",
|
|
46
52
|
"init_dce_project",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from databao_context_engine import DceInfo, DceProjectInfo, get_databao_context_engine_info
|
|
8
|
+
from databao_context_engine.project.info import get_databao_context_engine_project_info
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def echo_info(project_dir: Path) -> None:
|
|
12
|
+
dce_info = get_databao_context_engine_info()
|
|
13
|
+
dce_project_info = get_databao_context_engine_project_info(project_dir=project_dir)
|
|
14
|
+
click.echo(_generate_info_string(dce_info, dce_project_info))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _generate_info_string(dce_info: DceInfo, project_info: DceProjectInfo) -> str:
|
|
18
|
+
info_lines = []
|
|
19
|
+
info_lines.append(f"Databao context engine version: {dce_info.version}")
|
|
20
|
+
info_lines.append(f"Databao context engine storage dir: {dce_info.dce_path}")
|
|
21
|
+
info_lines.append(f"Databao context engine plugins: {dce_info.plugin_ids}")
|
|
22
|
+
|
|
23
|
+
info_lines.append("")
|
|
24
|
+
|
|
25
|
+
info_lines.append(f"OS name: {sys.platform}")
|
|
26
|
+
info_lines.append(f"OS architecture: {os.uname().machine if hasattr(os, 'uname') else 'unknown'}")
|
|
27
|
+
|
|
28
|
+
info_lines.append("")
|
|
29
|
+
|
|
30
|
+
if project_info.is_initialized:
|
|
31
|
+
info_lines.append(f"Project dir: {project_info.project_path.resolve()}")
|
|
32
|
+
info_lines.append(f"Project ID: {str(project_info.project_id)}")
|
|
33
|
+
else:
|
|
34
|
+
info_lines.append(f"Project not initialized at {project_info.project_path.resolve()}")
|
|
35
|
+
|
|
36
|
+
return os.linesep.join(info_lines)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from databao_context_engine.pluginlib.build_plugin import EmbeddableChunk
|
|
4
|
+
from databao_context_engine.plugins.dbt.types import DbtColumn, DbtContext, DbtModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class DbtColumnChunkContent:
|
|
9
|
+
database_name: str
|
|
10
|
+
schema_name: str
|
|
11
|
+
model_name: str
|
|
12
|
+
column: DbtColumn
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def build_dbt_chunks(context: DbtContext) -> list[EmbeddableChunk]:
|
|
16
|
+
chunks = []
|
|
17
|
+
|
|
18
|
+
for model in context.models:
|
|
19
|
+
chunks.append(_create_model_chunk(model))
|
|
20
|
+
|
|
21
|
+
for column in model.columns:
|
|
22
|
+
chunks.append(_create_column_chunk(model, column))
|
|
23
|
+
|
|
24
|
+
return chunks
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _create_model_chunk(model: DbtModel) -> EmbeddableChunk:
|
|
28
|
+
return EmbeddableChunk(embeddable_text=_build_model_chunk_text(model), content=model)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _build_model_chunk_text(model: DbtModel) -> str:
|
|
32
|
+
# TODO: Use description and potentially other infos?
|
|
33
|
+
return f"Model {model.name} in database {model.database} and schema {model.schema}, with unique id {model.id}"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _create_column_chunk(model: DbtModel, column: DbtColumn) -> EmbeddableChunk:
|
|
37
|
+
return EmbeddableChunk(
|
|
38
|
+
embeddable_text=_build_column_chunk_text(model, column),
|
|
39
|
+
content=DbtColumnChunkContent(
|
|
40
|
+
database_name=model.database, schema_name=model.schema, model_name=model.name, column=column
|
|
41
|
+
),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_column_chunk_text(model: DbtModel, column: DbtColumn) -> str:
|
|
46
|
+
# TODO: Use description and potentially other infos?
|
|
47
|
+
return f"Column {column.name} in model {model.id}"
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from collections import defaultdict
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from databao_context_engine.plugins.dbt.types import (
|
|
7
|
+
DbtAcceptedValuesConstraint,
|
|
8
|
+
DbtColumn,
|
|
9
|
+
DbtConfigFile,
|
|
10
|
+
DbtConstraint,
|
|
11
|
+
DbtContext,
|
|
12
|
+
DbtMaterialization,
|
|
13
|
+
DbtModel,
|
|
14
|
+
DbtRelationshipConstraint,
|
|
15
|
+
DbtSimpleConstraint,
|
|
16
|
+
)
|
|
17
|
+
from databao_context_engine.plugins.dbt.types_artifacts import (
|
|
18
|
+
DbtArtifacts,
|
|
19
|
+
DbtCatalog,
|
|
20
|
+
DbtCatalogColumn,
|
|
21
|
+
DbtCatalogNode,
|
|
22
|
+
DbtManifest,
|
|
23
|
+
DbtManifestColumn,
|
|
24
|
+
DbtManifestModel,
|
|
25
|
+
DbtManifestTest,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def check_connection(config_file: DbtConfigFile) -> None:
|
|
30
|
+
_read_dbt_artifacts(config_file.dbt_target_folder_path.expanduser())
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def extract_context(config_file: DbtConfigFile) -> DbtContext:
|
|
34
|
+
artifacts = _read_dbt_artifacts(config_file.dbt_target_folder_path.expanduser())
|
|
35
|
+
|
|
36
|
+
return _extract_context_from_artifacts(artifacts)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _read_dbt_artifacts(dbt_target_folder_path: Path) -> DbtArtifacts:
|
|
40
|
+
if not dbt_target_folder_path.is_dir():
|
|
41
|
+
raise ValueError(f'Invalid "dbt_target_folder_path": not a directory ({dbt_target_folder_path})')
|
|
42
|
+
|
|
43
|
+
# TODO: Check the manifest schema version?
|
|
44
|
+
manifest_file = dbt_target_folder_path.joinpath("manifest.json")
|
|
45
|
+
if not manifest_file.is_file():
|
|
46
|
+
raise ValueError(f'Invalid "dbt_target_folder_path": missing manifest.json file ({manifest_file})')
|
|
47
|
+
|
|
48
|
+
manifest = DbtManifest.model_validate_json(manifest_file.read_text())
|
|
49
|
+
|
|
50
|
+
catalog_file = dbt_target_folder_path.joinpath("catalog.json")
|
|
51
|
+
catalog = DbtCatalog.model_validate_json(catalog_file.read_text()) if catalog_file.is_file() else None
|
|
52
|
+
|
|
53
|
+
return DbtArtifacts(manifest=manifest, catalog=catalog)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _extract_context_from_artifacts(artifacts: DbtArtifacts) -> DbtContext:
|
|
57
|
+
manifest_models = [
|
|
58
|
+
manifest_node
|
|
59
|
+
for manifest_node in artifacts.manifest.nodes.values()
|
|
60
|
+
if isinstance(manifest_node, DbtManifestModel)
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
manifest_tests_by_model_and_column = _get_manifest_tests(artifacts.manifest)
|
|
64
|
+
|
|
65
|
+
catalog_nodes = artifacts.catalog.nodes if artifacts.catalog else {}
|
|
66
|
+
|
|
67
|
+
# TODO: Extract the stages? Or at least the "highest-level" models (= marts?)
|
|
68
|
+
# TODO: Organize the models by schemas? Or by stages?
|
|
69
|
+
return DbtContext(
|
|
70
|
+
models=[
|
|
71
|
+
_manifest_model_to_dbt_model(
|
|
72
|
+
manifest_model,
|
|
73
|
+
catalog_nodes.get(manifest_model.unique_id, None),
|
|
74
|
+
manifest_tests_by_model_and_column.get(manifest_model.unique_id, {}),
|
|
75
|
+
)
|
|
76
|
+
for manifest_model in manifest_models
|
|
77
|
+
],
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _get_manifest_tests(manifest: DbtManifest) -> dict[Any, dict[Any, list]]:
|
|
82
|
+
"""Extract all tests nodes in the manifest and groups them by model and column."""
|
|
83
|
+
manifest_tests_by_model_and_column: dict[str, dict[str, list[DbtManifestTest]]] = defaultdict(
|
|
84
|
+
lambda: defaultdict(list)
|
|
85
|
+
)
|
|
86
|
+
for manifest_node in manifest.nodes.values():
|
|
87
|
+
if isinstance(manifest_node, DbtManifestTest) and manifest_node.attached_node and manifest_node.column_name:
|
|
88
|
+
manifest_tests_by_model_and_column[manifest_node.attached_node][manifest_node.column_name].append(
|
|
89
|
+
manifest_node
|
|
90
|
+
)
|
|
91
|
+
return manifest_tests_by_model_and_column
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _manifest_model_to_dbt_model(
|
|
95
|
+
manifest_model: DbtManifestModel,
|
|
96
|
+
catalog_node: DbtCatalogNode | None,
|
|
97
|
+
test_nodes_by_column_name: dict[str, list[DbtManifestTest]],
|
|
98
|
+
) -> DbtModel:
|
|
99
|
+
catalog_columns = catalog_node.columns if catalog_node else {}
|
|
100
|
+
|
|
101
|
+
return DbtModel(
|
|
102
|
+
id=manifest_model.unique_id,
|
|
103
|
+
name=manifest_model.name,
|
|
104
|
+
database=manifest_model.database,
|
|
105
|
+
schema=manifest_model.schema_,
|
|
106
|
+
description=manifest_model.description,
|
|
107
|
+
columns=[
|
|
108
|
+
_manifest_column_to_dbt_column(
|
|
109
|
+
manifest_column,
|
|
110
|
+
catalog_columns.get(manifest_column.name),
|
|
111
|
+
test_nodes_by_column_name.get(manifest_column.name, []),
|
|
112
|
+
)
|
|
113
|
+
for manifest_column in manifest_model.columns.values()
|
|
114
|
+
],
|
|
115
|
+
materialization=_manifest_materialization_to_dbt_materializaton(
|
|
116
|
+
manifest_model.config.materialized if manifest_model.config else None
|
|
117
|
+
),
|
|
118
|
+
primary_key=manifest_model.primary_key,
|
|
119
|
+
depends_on_nodes=manifest_model.depends_on.get("nodes", []) if manifest_model.depends_on else [],
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _manifest_column_to_dbt_column(
|
|
124
|
+
manifest_column: DbtManifestColumn, catalog_column: DbtCatalogColumn | None, test_nodes: list[DbtManifestTest]
|
|
125
|
+
) -> DbtColumn:
|
|
126
|
+
constraints = _manifest_test_to_dbt_constraint(test_nodes)
|
|
127
|
+
|
|
128
|
+
return DbtColumn(
|
|
129
|
+
name=manifest_column.name,
|
|
130
|
+
description=manifest_column.description,
|
|
131
|
+
type=catalog_column.type if catalog_column else manifest_column.data_type,
|
|
132
|
+
constraints=constraints,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _manifest_test_to_dbt_constraint(test_nodes: list[DbtManifestTest]) -> list[DbtConstraint]:
|
|
137
|
+
result: list[DbtConstraint] = []
|
|
138
|
+
|
|
139
|
+
for test_node in test_nodes:
|
|
140
|
+
is_enforced = test_node.config.severity == "ERROR" if test_node.config else False
|
|
141
|
+
|
|
142
|
+
if test_node.test_metadata is None:
|
|
143
|
+
continue
|
|
144
|
+
|
|
145
|
+
match test_node.test_metadata.name:
|
|
146
|
+
case "not_null":
|
|
147
|
+
result.append(
|
|
148
|
+
DbtSimpleConstraint(type="not_null", is_enforced=is_enforced, description=test_node.description)
|
|
149
|
+
)
|
|
150
|
+
case "unique":
|
|
151
|
+
result.append(
|
|
152
|
+
DbtSimpleConstraint(type="unique", is_enforced=is_enforced, description=test_node.description)
|
|
153
|
+
)
|
|
154
|
+
case "accepted_values":
|
|
155
|
+
if test_node.test_metadata.kwargs is None:
|
|
156
|
+
continue
|
|
157
|
+
|
|
158
|
+
accepted_values = test_node.test_metadata.kwargs.get("values", None)
|
|
159
|
+
if accepted_values is None:
|
|
160
|
+
continue
|
|
161
|
+
result.append(
|
|
162
|
+
DbtAcceptedValuesConstraint(
|
|
163
|
+
type="accepted_values",
|
|
164
|
+
is_enforced=is_enforced,
|
|
165
|
+
description=test_node.description,
|
|
166
|
+
accepted_values=accepted_values,
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
case "relationships":
|
|
170
|
+
if test_node.test_metadata.kwargs is None:
|
|
171
|
+
continue
|
|
172
|
+
|
|
173
|
+
target_model = _extract_ref_model(test_node.test_metadata.kwargs.get("to", None))
|
|
174
|
+
if target_model is None:
|
|
175
|
+
continue
|
|
176
|
+
target_column = test_node.test_metadata.kwargs.get("field", None)
|
|
177
|
+
if target_column is None:
|
|
178
|
+
continue
|
|
179
|
+
result.append(
|
|
180
|
+
DbtRelationshipConstraint(
|
|
181
|
+
type="relationships",
|
|
182
|
+
is_enforced=is_enforced,
|
|
183
|
+
description=test_node.description,
|
|
184
|
+
target_model=target_model,
|
|
185
|
+
target_column=target_column,
|
|
186
|
+
)
|
|
187
|
+
)
|
|
188
|
+
case _:
|
|
189
|
+
continue
|
|
190
|
+
|
|
191
|
+
return result
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _extract_ref_model(target_model_with_ref: str | None) -> str | None:
|
|
195
|
+
if target_model_with_ref is None:
|
|
196
|
+
return None
|
|
197
|
+
|
|
198
|
+
match = re.fullmatch(r"ref\(['\"]([\w.]+)['\"]\)", target_model_with_ref)
|
|
199
|
+
if match:
|
|
200
|
+
return match.group(1)
|
|
201
|
+
|
|
202
|
+
return None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _manifest_materialization_to_dbt_materializaton(materialized: str | None) -> DbtMaterialization | None:
|
|
206
|
+
if materialized is None:
|
|
207
|
+
return None
|
|
208
|
+
|
|
209
|
+
try:
|
|
210
|
+
return DbtMaterialization(materialized)
|
|
211
|
+
except ValueError:
|
|
212
|
+
return None
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from databao_context_engine import BuildDatasourcePlugin
|
|
4
|
+
from databao_context_engine.pluginlib.build_plugin import EmbeddableChunk
|
|
5
|
+
from databao_context_engine.plugins.dbt.dbt_chunker import build_dbt_chunks
|
|
6
|
+
from databao_context_engine.plugins.dbt.dbt_context_extractor import check_connection, extract_context
|
|
7
|
+
from databao_context_engine.plugins.dbt.types import DbtConfigFile
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DbtPlugin(BuildDatasourcePlugin[DbtConfigFile]):
|
|
11
|
+
id = "jetbrains/dbt"
|
|
12
|
+
name = "Dbt Plugin"
|
|
13
|
+
config_file_type = DbtConfigFile
|
|
14
|
+
|
|
15
|
+
def supported_types(self) -> set[str]:
|
|
16
|
+
return {"dbt"}
|
|
17
|
+
|
|
18
|
+
def build_context(self, full_type: str, datasource_name: str, file_config: DbtConfigFile) -> Any:
|
|
19
|
+
return extract_context(file_config)
|
|
20
|
+
|
|
21
|
+
def check_connection(self, full_type: str, datasource_name: str, file_config: DbtConfigFile) -> None:
|
|
22
|
+
check_connection(file_config)
|
|
23
|
+
|
|
24
|
+
def divide_context_into_chunks(self, context: Any) -> list[EmbeddableChunk]:
|
|
25
|
+
return build_dbt_chunks(context)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DbtConfigFile(BaseModel):
|
|
10
|
+
name: str | None = Field(default=None)
|
|
11
|
+
type: str = Field(default="dbt")
|
|
12
|
+
dbt_target_folder_path: Path
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DbtMaterialization(str, Enum):
|
|
16
|
+
TABLE = "table"
|
|
17
|
+
VIEW = "view"
|
|
18
|
+
|
|
19
|
+
def __str__(self):
|
|
20
|
+
return self.value
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(kw_only=True)
|
|
24
|
+
class DbtSimpleConstraint:
|
|
25
|
+
type: Literal["unique", "not_null"]
|
|
26
|
+
is_enforced: bool
|
|
27
|
+
description: str | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(kw_only=True)
|
|
31
|
+
class DbtAcceptedValuesConstraint:
|
|
32
|
+
type: Literal["accepted_values"]
|
|
33
|
+
is_enforced: bool
|
|
34
|
+
description: str | None = None
|
|
35
|
+
accepted_values: list[str]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(kw_only=True)
|
|
39
|
+
class DbtRelationshipConstraint:
|
|
40
|
+
type: Literal["relationships"]
|
|
41
|
+
is_enforced: bool
|
|
42
|
+
description: str | None = None
|
|
43
|
+
target_model: str
|
|
44
|
+
target_column: str
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
DbtConstraint = DbtSimpleConstraint | DbtAcceptedValuesConstraint | DbtRelationshipConstraint
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(kw_only=True)
|
|
51
|
+
class DbtColumn:
|
|
52
|
+
name: str
|
|
53
|
+
type: str | None = None
|
|
54
|
+
description: str | None = None
|
|
55
|
+
constraints: list[DbtConstraint] | None = None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(kw_only=True)
|
|
59
|
+
class DbtModel:
|
|
60
|
+
id: str
|
|
61
|
+
name: str
|
|
62
|
+
database: str
|
|
63
|
+
schema: str
|
|
64
|
+
columns: list[DbtColumn]
|
|
65
|
+
description: str | None = None
|
|
66
|
+
materialization: DbtMaterialization | None = None
|
|
67
|
+
primary_key: list[str] | None = None
|
|
68
|
+
depends_on_nodes: list[str]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(kw_only=True)
|
|
72
|
+
class DbtContext:
|
|
73
|
+
models: list[DbtModel]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Annotated, Any, Literal
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel, Discriminator, Field
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DbtManifestModelConfig(BaseModel):
|
|
8
|
+
materialized: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DbtManifestColumn(BaseModel):
|
|
12
|
+
name: str
|
|
13
|
+
description: str | None = None
|
|
14
|
+
data_type: str | None = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DbtManifestModel(BaseModel):
|
|
18
|
+
resource_type: Literal["model"]
|
|
19
|
+
unique_id: str
|
|
20
|
+
name: str
|
|
21
|
+
database: str
|
|
22
|
+
schema_: str = Field(alias="schema")
|
|
23
|
+
description: str | None = None
|
|
24
|
+
config: DbtManifestModelConfig | None = None
|
|
25
|
+
columns: dict[str, DbtManifestColumn]
|
|
26
|
+
depends_on: dict[str, list[str]] | None = None
|
|
27
|
+
primary_key: list[str] | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class DbtManifestTestConfig(BaseModel):
|
|
31
|
+
severity: str
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DbtManifestTestMetadata(BaseModel):
|
|
35
|
+
name: str | None = None
|
|
36
|
+
kwargs: dict[str, Any] | None = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class DbtManifestTest(BaseModel):
|
|
40
|
+
resource_type: Literal["test"]
|
|
41
|
+
unique_id: str
|
|
42
|
+
attached_node: str | None = None
|
|
43
|
+
column_name: str | None = None
|
|
44
|
+
description: str | None = None
|
|
45
|
+
test_metadata: DbtManifestTestMetadata | None = None
|
|
46
|
+
config: DbtManifestTestConfig | None = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class DbtManifestOtherNode(BaseModel):
|
|
50
|
+
resource_type: Literal["seed", "analysis", "operation", "sql_operation", "snapshot"]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
DbtManifestNode = Annotated[DbtManifestModel | DbtManifestTest | DbtManifestOtherNode, Discriminator("resource_type")]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class DbtManifest(BaseModel):
|
|
57
|
+
nodes: dict[str, DbtManifestNode]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class DbtCatalogColumn(BaseModel):
|
|
61
|
+
name: str
|
|
62
|
+
type: str
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class DbtCatalogNode(BaseModel):
|
|
66
|
+
unique_id: str | None = None
|
|
67
|
+
columns: dict[str, DbtCatalogColumn]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class DbtCatalog(BaseModel):
|
|
71
|
+
nodes: dict[str, DbtCatalogNode]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(kw_only=True)
|
|
75
|
+
class DbtArtifacts:
|
|
76
|
+
manifest: DbtManifest
|
|
77
|
+
catalog: DbtCatalog | None
|
|
@@ -45,6 +45,7 @@ def _load_builtin_datasource_plugins() -> list[BuildDatasourcePlugin]:
|
|
|
45
45
|
"""Statically register built-in plugins."""
|
|
46
46
|
from databao_context_engine.plugins.databases.duckdb.duckdb_db_plugin import DuckDbPlugin
|
|
47
47
|
from databao_context_engine.plugins.databases.sqlite.sqlite_db_plugin import SQLiteDbPlugin
|
|
48
|
+
from databao_context_engine.plugins.dbt.dbt_plugin import DbtPlugin
|
|
48
49
|
from databao_context_engine.plugins.resources.parquet_plugin import ParquetPlugin
|
|
49
50
|
|
|
50
51
|
# optional plugins are added to the python environment via extras
|
|
@@ -91,7 +92,7 @@ def _load_builtin_datasource_plugins() -> list[BuildDatasourcePlugin]:
|
|
|
91
92
|
except ImportError:
|
|
92
93
|
pass
|
|
93
94
|
|
|
94
|
-
required_plugins: list[BuildDatasourcePlugin] = [DuckDbPlugin(), ParquetPlugin(), SQLiteDbPlugin()]
|
|
95
|
+
required_plugins: list[BuildDatasourcePlugin] = [DuckDbPlugin(), ParquetPlugin(), SQLiteDbPlugin(), DbtPlugin()]
|
|
95
96
|
return required_plugins + optional_plugins
|
|
96
97
|
|
|
97
98
|
|
|
@@ -30,33 +30,38 @@ class DceInfo:
|
|
|
30
30
|
Attributes:
|
|
31
31
|
version: The version of the databao_context_engine package installed on the system.
|
|
32
32
|
dce_path: The path where databao_context_engine stores its global data.
|
|
33
|
-
project_info: Information about the Databao Context Engine project.
|
|
34
33
|
"""
|
|
35
34
|
|
|
36
35
|
version: str
|
|
37
36
|
dce_path: Path
|
|
38
37
|
plugin_ids: list[str]
|
|
39
38
|
|
|
40
|
-
project_info: DceProjectInfo
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
def get_databao_context_engine_info(project_dir: Path) -> DceInfo:
|
|
40
|
+
def get_databao_context_engine_info() -> DceInfo:
|
|
44
41
|
"""Return information about the current Databao Context Engine installation and project.
|
|
45
42
|
|
|
46
|
-
Args:
|
|
47
|
-
project_dir: The root directory of the Databao Context Project.
|
|
48
|
-
|
|
49
43
|
Returns:
|
|
50
|
-
A DceInfo instance containing information about the Databao Context Engine installation
|
|
44
|
+
A DceInfo instance containing information about the Databao Context Engine installation.
|
|
51
45
|
"""
|
|
52
46
|
return DceInfo(
|
|
53
47
|
version=get_dce_version(),
|
|
54
48
|
dce_path=get_dce_path(),
|
|
55
49
|
plugin_ids=[plugin.id for plugin in load_plugins().values()],
|
|
56
|
-
project_info=_get_project_info(project_dir),
|
|
57
50
|
)
|
|
58
51
|
|
|
59
52
|
|
|
53
|
+
def get_databao_context_engine_project_info(project_dir: Path) -> DceProjectInfo:
|
|
54
|
+
"""Return information about the current Databao Context Engine project.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
project_dir: The root directory of the Databao Context Project.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
A DceProjectInfo instance containing information about the Databao Context Engine project.
|
|
61
|
+
"""
|
|
62
|
+
return _get_project_info(project_dir)
|
|
63
|
+
|
|
64
|
+
|
|
60
65
|
def _get_project_info(project_dir: Path) -> DceProjectInfo:
|
|
61
66
|
project_layout = validate_project_dir(project_dir)
|
|
62
67
|
|
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
import click
|
|
6
|
-
|
|
7
|
-
from databao_context_engine import DceInfo, get_databao_context_engine_info
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def echo_info(project_dir: Path) -> None:
|
|
11
|
-
click.echo(_generate_info_string(get_databao_context_engine_info(project_dir=project_dir)))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _generate_info_string(command_info: DceInfo) -> str:
|
|
15
|
-
info_lines = []
|
|
16
|
-
info_lines.append(f"Databao context engine version: {command_info.version}")
|
|
17
|
-
info_lines.append(f"Databao context engine storage dir: {command_info.dce_path}")
|
|
18
|
-
info_lines.append(f"Databao context engine plugins: {command_info.plugin_ids}")
|
|
19
|
-
|
|
20
|
-
info_lines.append("")
|
|
21
|
-
|
|
22
|
-
info_lines.append(f"OS name: {sys.platform}")
|
|
23
|
-
info_lines.append(f"OS architecture: {os.uname().machine if hasattr(os, 'uname') else 'unknown'}")
|
|
24
|
-
|
|
25
|
-
info_lines.append("")
|
|
26
|
-
|
|
27
|
-
if command_info.project_info.is_initialized:
|
|
28
|
-
info_lines.append(f"Project dir: {command_info.project_info.project_path.resolve()}")
|
|
29
|
-
info_lines.append(f"Project ID: {str(command_info.project_info.project_id)}")
|
|
30
|
-
else:
|
|
31
|
-
info_lines.append(f"Project not initialized at {command_info.project_info.project_path.resolve()}")
|
|
32
|
-
|
|
33
|
-
return os.linesep.join(info_lines)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/llm/api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databao_context_engine-0.1.5 → databao_context_engine-0.1.7}/src/databao_context_engine/main.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|