vanna.types

@dataclass
class Status:
Status(success: bool, message: str)
success: bool
message: str
@dataclass
class StatusWithId:
StatusWithId(success: bool, message: str, id: str)
success: bool
message: str
id: str
@dataclass
class QuestionList:
QuestionList(questions: List[FullQuestionDocument])
questions: List[FullQuestionDocument]
@dataclass
class FullQuestionDocument:
FullQuestionDocument( id: QuestionId, question: Question, answer: SQLAnswer | None, data: DataResult | None, plotly: PlotlyResult | None)
question: Question
answer: SQLAnswer | None
data: DataResult | None
plotly: PlotlyResult | None
@dataclass
class QuestionSQLPair:
QuestionSQLPair(question: str, sql: str, tag: Optional[str])
question: str
sql: str
tag: Optional[str]
@dataclass
class Organization:
Organization( name: str, user: str | None, connection: Connection | None)
name: str
user: str | None
connection: Connection | None
@dataclass
class OrganizationList:
OrganizationList(organizations: List[str])
organizations: List[str]
@dataclass
class QuestionStringList:
QuestionStringList(questions: List[str])
questions: List[str]
@dataclass
class Visibility:
Visibility(visibility: bool)
visibility: bool
@dataclass
class UserEmail:
UserEmail(email: str)
email: str
@dataclass
class NewOrganization:
NewOrganization(org_name: str, db_type: str)
org_name: str
db_type: str
@dataclass
class NewOrganizationMember:
NewOrganizationMember(org_name: str, email: str, is_admin: bool)
org_name: str
email: str
is_admin: bool
@dataclass
class UserOTP:
UserOTP(email: str, otp: str)
email: str
otp: str
@dataclass
class ApiKey:
ApiKey(key: str)
key: str
@dataclass
class QuestionId:
QuestionId(id: str)
id: str
@dataclass
class Question:
Question(question: str)
question: str
@dataclass
class QuestionCategory:
QuestionCategory(question: str, category: str)
question: str
category: str
NO_SQL_GENERATED = 'No SQL Generated'
SQL_UNABLE_TO_RUN = 'SQL Unable to Run'
BOOTSTRAP_TRAINING_QUERY = 'Bootstrap Training Query'
SQL_RAN = 'SQL Ran Successfully'
FLAGGED_FOR_REVIEW = 'Flagged for Review'
REVIEWED_AND_APPROVED = 'Reviewed and Approved'
REVIEWED_AND_REJECTED = 'Reviewed and Rejected'
REVIEWED_AND_UPDATED = 'Reviewed and Updated'
@dataclass
class AccuracyStats:
AccuracyStats(num_questions: int, data: Dict[str, int])
num_questions: int
data: Dict[str, int]
@dataclass
class Followup:
Followup(followup: str)
followup: str
@dataclass
class QuestionEmbedding:
QuestionEmbedding(question: Question, embedding: List[float])
question: Question
embedding: List[float]
@dataclass
class Connection:
@dataclass
class SQLAnswer:
SQLAnswer(raw_answer: str, prefix: str, postfix: str, sql: str)
raw_answer: str
prefix: str
postfix: str
sql: str
@dataclass
class Explanation:
Explanation(explanation: str)
explanation: str
@dataclass
class DataResult:
DataResult( question: str | None, sql: str | None, table_markdown: str, error: str | None, correction_attempts: int)
question: str | None
sql: str | None
table_markdown: str
error: str | None
correction_attempts: int
@dataclass
class PlotlyResult:
PlotlyResult(plotly_code: str)
plotly_code: str
@dataclass
class WarehouseDefinition:
WarehouseDefinition(name: str, tables: List[TableDefinition])
name: str
tables: List[TableDefinition]
@dataclass
class TableDefinition:
TableDefinition( schema_name: str, table_name: str, ddl: str | None, columns: List[ColumnDefinition])
schema_name: str
table_name: str
ddl: str | None
columns: List[ColumnDefinition]
@dataclass
class ColumnDefinition:
ColumnDefinition( name: str, type: str, is_primary_key: bool, is_foreign_key: bool, foreign_key_table: str, foreign_key_column: str)
name: str
type: str
is_primary_key: bool
is_foreign_key: bool
foreign_key_table: str
foreign_key_column: str
@dataclass
class Diagram:
Diagram(raw: str, mermaid_code: str)
raw: str
mermaid_code: str
@dataclass
class StringData:
StringData(data: str)
data: str
@dataclass
class DataFrameJSON:
DataFrameJSON(data: str)
data: str
@dataclass
class TrainingData:
TrainingData(questions: List[dict], ddl: List[str], documentation: List[str])
questions: List[dict]
ddl: List[str]
documentation: List[str]
@dataclass
class TrainingPlanItem:
TrainingPlanItem(item_type: str, item_group: str, item_name: str, item_value: str)
item_type: str
item_group: str
item_name: str
item_value: str
ITEM_TYPE_SQL = 'sql'
ITEM_TYPE_DDL = 'ddl'
ITEM_TYPE_IS = 'is'
class TrainingPlan:

A class representing a training plan. You can see what's in it, and remove items from it that you don't want trained.

Example:

plan = vn.get_training_plan()

plan.get_summary()
TrainingPlan(plan: List[TrainingPlanItem])
def get_summary(self) -> List[str]:

Example:

plan = vn.get_training_plan()

plan.get_summary()

Get a summary of the training plan.

Returns:

List[str]: A list of strings describing the training plan.

def remove_item(self, item: str):

Example:

plan = vn.get_training_plan()

plan.remove_item("Train on SQL: What is the average salary of employees?")

Remove an item from the training plan.

Arguments:
  • item (str): The item to remove.