Package mindsdb.models
Class MDBTable
java.lang.Object
mindsdb.services.Query
mindsdb.models.MDBTable
- Direct Known Subclasses:
View
The MDBTable class represents a table in the MindsDB system. It extends the
Query class and provides methods to interact with the table, such as
filtering, limiting, tracking, inserting, deleting, and updating data.
Example usage:
Database db = server.getDatabase("my_database");
MDBTable table = db.getTable("my_table");
table.filter("column1=value1").limit(10).track("column2");
table.insert(someQuery);
table.insert(someDataFrame);
table.delete("column1=value1");
table.update(Map.of("column1", "new_value"), "column2=value2");
The class also overrides the toString
method to provide a string
representation of the MDBTable object.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes record from table using filters >>> table.delete("a=1", "b=2")Filter the table by key-value pairs >>> table.filter("a=1", "b=2") *void
Insert data into tablevoid
insert
(tech.tablesaw.api.Table query) Insert data into tableLimit the number of rows returned by the querytoString()
Track the table by a columnvoid
Update table by conditionvoid
Update table by condition
-
Constructor Details
-
MDBTable
Create a new Mindsdb Table object- Parameters:
database
- - Database objectname
- - Name of the table
-
MDBTable
Create a new Mindsdb Table object- Parameters:
project
- - Project objectname
- - Name of the table
-
-
Method Details
-
toString
-
filter
Filter the table by key-value pairs >>> table.filter("a=1", "b=2") *- Parameters:
filters
- - Key-value pairs to filter the table by- Returns:
- Table object with the filters set
-
limit
Limit the number of rows returned by the query- Parameters:
limit
- - Number of rows to limit the query to- Returns:
- Table object with the limit set
-
track
Track the table by a column- Parameters:
column
- - Column to track the table by- Returns:
- Table object with the track column set
-
insert
Insert data into table- Parameters:
query
- a Query object representing the data to insert
-
insert
public void insert(tech.tablesaw.api.Table query) Insert data into table- Parameters:
query
- a Tablesaw Table object representing the data to insert
-
delete
Deletes record from table using filters >>> table.delete("a=1", "b=2")- Parameters:
filters
- array of filters to filter deleted rows, delete("column=value", ...)
-
update
Update table by condition- Parameters:
values
- a map representing fields to updatefilters
- array of filters to filter updated rows, update(values, "column=value", ...)
-
update
Update table by condition- Parameters:
value
- a Query object representing the data to updateon
- array of the columns to update on
-