Python 3 library for working code-first with Sqlite - sqlite

Is there a Python 3 library that allows working with SQL databases using a code-first approach?
By code-first I understand being able to infer the DB schema from a set of classes and to generate DDL queries to create the DB objects if needed.
I'm particularly interested in working with a Sqlite database.

SQLAlchemy supports Python 3. It also support SQLite, and defining the schema as Python classes, so it seems like the perfect fit for your requirements.

Related

What is the difference between the nuget packages System.Data.Sqlite and Sqlite

I currently included System.Data.Sqlite and use ExecuteNonQuery() and parameterized queries.
That requires LINQ and EntityFramework 6 which i don't use.
I would like to know if i can remove System.Data.Sqlite and use the SQLite v3.13.0 NuGet package instead, or do i loose access to parameterized queries and ExecuteNonQuery() if I do that?
No, it does not include any method like ExecuteNonQuery() or support for parameterized queries, at least using the objects that you'll find in a standard .Net library. Those interfaces are part of the .Net wrappers around the basic sqlite library.
The SQLite v3.13.0 NuGet package contains the native compilations of the C-source library. It does not include any interop library suitable for direct inclusion in a managed .Net project.

EntityFrameworkCore support for stored procedure

I am learning dotnet core and trying my hand on EntityFrameworkCore 2.2.I am trying my lab using database first approach, where I want to execute stored procedures which will contain multiple joins. Stored procedures perform read write operation. I am looking for option which is similar to EF6 in botnet 4.5 framework, where we only import stored procedure from DB and entity framework create complex type for DB result.I read multiple articles but none of these has clearly mention that whether EF core support stored procedure or not ,I want to execute mostly complex stored procedure which contains joins etc.
What I found in multiple tutorial is that everyone is importing tables in EFCore but not only complex SP. Any kind of help and suggestion will be very helpful like how to achieve it or any link to article.
I was facing the same issue and after searching it on internet i have found this resource:
Execute Stored Procedures In MVC Core Using Entity Framework Core
Now I am able to call complex type SP from EFCore, hope it will help you.
Thanks

Is it possible to use pure functionality of sqlite-net-pcl and Akavache using it in same project?

In Akavache docs said that it's powered by SQLite.
And from what I heard Akavache is quite nice tool for the key-value storage and sometimes you just don't want to store some cached data into SQL.
Also, usually in mobile apps you also require some data stored in SQL-manner.
In that case it requires two db approaches to be used through the app: SQL and Non-SQL. So, as long as Akavache is still based on SQLite, is there any way to use both: SQLite and Akavache, which uses the sam SQLite (files)?
This is referred in context of Xamarin .NET Standard projects.
Any hints?

Monotouch Sqlite-net or ADO.Net

I would like to use Sqlite database in my Monotouch app. From http://docs.xamarin.com/recipes/ios/data/sqlite i see two options.
Sqlite-net
ADO.NET
Doing research i found that Sqlite-net is easy to use, works on both ios and android but does not support foreign key concept. My need is to have relations in my db. Student table is linked to classes, professor, assignments table. Not so complicated!!!
Does Sqlite-net supports such relations? Which one is better choice Sqlite-net or ADO.Net.
Appreciated...
Thanks
ADO.Net doesn't give you out of the box support for relationships either. It only gives you raw classes like SQLCommand and SQLDataReader.
I would highly recommend sqlite-net, as it is a huge timesaver in being an ORM.
You can setup foreign keys by calling manual SQL statements in sqlite-net, which is the same you would do with ADO.Net anyway.
So with sqlite-net, there are several ways you could setup your database:
Call sqlite-net's APIs for creating tables based on your C# classes, then add things it doesn't support with manual SQL like foreign keys and indexes
Include an empty database with your app with the full schema already setup
Create the entire database with a raw SQL script
I tend to go with option #2 if I want full control of the database schema (and it's a little easier to include a database file I made in SQLite Expert). sqlite-net should work with an existing database just fine.

Will using dblinq to SQLite in a Windows Store app pass store validation?

I've been trying to figure out how to get a decent LINQ to something working for ORM database access in a Windows Store app.
All I've found is SQLite and the sqlite-net NuGet package. The latter sucks a bit, as I don't get any .dbml like structure which resolves relationships and provides navigation properties for easy querying (no manual joins needed then).
I was wondering:
Does dblinq in comnbination with SQLite offer this?
Will using this pass Windows Store validation?
Thank you !
Update: Some links I used in my research:
The famous Tim Heuer post on SQLite and Windows 8: http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx
DBlinq: http://code.google.com/p/dblinq2007/
sqlite-net: http://code.google.com/p/sqlite-net/
Interesting discussion stating ADO.NET is not possible: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/e9cdd75d-03e4-4577-988e-4c02a52e3f50
I'm not familiar with dblinq but by looking at the sqlite tests in the project, it seems the library is offering what you're looking for, i.e. navigation properties for relationships between different tables.
Since dblinq is a .NET library, using it shouldn't make the store validation fail. There is another problem though: you can't use such a .NET library in a Windows Store application, only Windows Store class libraries and portable class libraries are allowed. Since the source for the library is available, you can try compiling it as a Windows Store class library, but I'm afraid there are going to be some classes missing that dblinq is depending on which might make it difficult to port.

Resources