-
Hey, so I want to use sqlite3, but opted for drift just because I like docs and isolate handling. So I'm using drift but only customSelects and so. Can I do
But I don't have any tables, hence I don't know how to use From my research, the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is a dumb workaround that I have for now. I'm creating a table and then never using it but sending it as a parameter to
|
Beta Was this translation helpful? Give feedback.
-
We're expecting tables instead of names here since these are exposed as getters in a typical drift usage (it would be less convenient to use names which requires users to always use class EmptyTable extends Table with TableInfo<EmptyTable, Never> {
@override
final String actualTableName;
EmptyTable(this.actualTableName);
@override
List<GeneratedColumn<Object>> get $columns => throw UnimplementedError();
@override
DatabaseConnectionUser get attachedDatabase => throw UnimplementedError();
@override
TableInfo<EmptyTable, Never> createAlias(String alias) {
throw UnimplementedError();
}
@override
Never map(Map<String, dynamic> data, {String? tablePrefix}) {
throw UnimplementedError();
}
} Then you can use table names by wrapping them in |
Beta Was this translation helpful? Give feedback.
We're expecting tables instead of names here since these are exposed as getters in a typical drift usage (it would be less convenient to use names which requires users to always use
someTable.tableName
). Adding tables like you did is possible, you can also use a custom table implementation not added to the database (thus not needing any codegen steps):