From a8e2a183d7535cc96d1f03d513e5f03a3b029b50 Mon Sep 17 00:00:00 2001 From: App Generator Date: Fri, 11 Feb 2022 16:38:31 +0200 Subject: [PATCH 1/5] Added new helper: dump_models() --- util/__init__.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/util/__init__.py b/util/__init__.py index 2b1817e..81feeab 100644 --- a/util/__init__.py +++ b/util/__init__.py @@ -213,6 +213,42 @@ def dump_tables(self, aFileName=None): file_write('output/' + aFileName, sqlContent) return True + def dump_models(self, aFileName=None): + + sqlContent = '' + + if not self._models: + print( ' > Error: No DB models' ) + return False + + if not aFileName: + aFileName = get_date() + '_' + self.driver + '_models' + + if not aFileName.endswith('.sql'): + aFileName += '.sql' + + for table_name in self._models.keys(): + + # SQLite Engine Metadata + if 'sqlite_sequence' == table_name: + continue + + # Unused + aModel = self._models[ table_name ] + + # Hack the print + with Capturing() as output: + + self.print_db_model( table_name ) + + sqlContent += '\n' + sqlContent += '-- Table: ' + table_name + '\n' + sqlContent += h_list_to_s( output, '\n' ) + sqlContent += ';\n' + + file_write('output/' + aFileName, sqlContent) + return True + def dump_tables_data(self, aFileName=None): sqlContent = '' @@ -232,7 +268,7 @@ def dump_tables_data(self, aFileName=None): # SQLite Engine Metadata if 'sqlite_sequence' == table_name: continue - + print( ' > Dump data for [' + table_name + ']' ) self.dump_model_data( table_name ) From 5f6a1cb9dda6d10d5d8abac00bf3b0db8407c6d3 Mon Sep 17 00:00:00 2001 From: App Generator <51070104+app-generator@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:22:19 +0200 Subject: [PATCH 2/5] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ffa365b..0dd2a5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# DB Migration Tool +# Database Introspection Tool -`Open-Source` project that provides simple helpers for database migrations. +`Open-Source` tool that provides simple helpers for legacy databases introspection. Crafted on top of `Python` and [Peewee](http://docs.peewee-orm.com/en/latest/).
@@ -104,4 +104,4 @@ $ SQLITE_django_migrations.sql
--- -DB Migration Tool - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). +Database Introspection Tool - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). From 551d15174e6e57b0c9c181c7811806f39d1d7b80 Mon Sep 17 00:00:00 2001 From: App Generator <51070104+app-generator@users.noreply.github.com> Date: Mon, 25 Jul 2022 18:23:45 +0300 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dd2a5e..104ecb8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Database Introspection Tool -`Open-Source` tool that provides simple helpers for legacy databases introspection. Crafted on top of `Python` and [Peewee](http://docs.peewee-orm.com/en/latest/). +`Open-Source` **[developers tool](https://appseed.us/developer-tools/)** that provides simple helpers for legacy databases introspection. Crafted on top of `Python` and [Peewee](http://docs.peewee-orm.com/en/latest/).
From d10dbf5f71f26db714dbbe8bfa609b9edb677e29 Mon Sep 17 00:00:00 2001 From: App Generator <51070104+app-generator@users.noreply.github.com> Date: Mon, 25 Jul 2022 18:50:31 +0300 Subject: [PATCH 4/5] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd0045a..215ac1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Change Log - ## [0.0.1] 2022-11-02 ### Minimal Version From 0953822f0a8f8f3b14a7d197e5319c8b347cc965 Mon Sep 17 00:00:00 2001 From: App Generator <51070104+app-generator@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:47:01 +0300 Subject: [PATCH 5/5] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 104ecb8..0985f96 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ `Open-Source` **[developers tool](https://appseed.us/developer-tools/)** that provides simple helpers for legacy databases introspection. Crafted on top of `Python` and [Peewee](http://docs.peewee-orm.com/en/latest/). +- 👉 Free [support](https://appseed.us/support/) via Email and [Discord](https://discord.gg/fZC6hup) +- 👉 More [Developer Tools](https://appseed.us/developer-tools/) - provided by AppSeed +
> Features pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy