Code Monkey home page Code Monkey logo

uprooted's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

uprooted's Issues

Change boolean fields to question form.

UpRooted::Schema::Column.is-nullable, UpRooted::Writer.use-schema-prefix, etc.

Less confusing, because in old layout one my expect to provide actual data like UpRooted::Writer.new( schema-prefix => 'foo' ).

Fix case mess in naming

Places to check:

  • POD
  • code comments
  • error messages
  • test descriptions
  • readmes

Consistent naming pattern:

  • If something refers to UpRooted::* object instance it should go by full name.
  • If something refers to resource like table in database it should be named as table, not Table (because there is no Table namespace or object anywhere)

Make Docker image based on Alpine Raku image.

Many potential users who want to use UpRooted may be discouraged by installation of Raku, studying package management and installing needed C libraries on their system.

Docker image with Raku, DBI, C libraries and UpRooted preinstalled will be a good start for those who want to simply get the job done without deep diving into Raku ecosystem.

Implement VALUES batching in `Writer::*SQLFile`.

This is nice to have feature but complicates Writer a lot - next row of data must have ability to terminate previous set of rows and leaving writing after last row must terminate everything..

It will be implemented if it gets 8 upvotes here :)

Implement `Writer` base class.

It should accept Channel from Reader.
On this Channel there will be Table followed by set of rows from this Table. When all Tables are read Channel will be closed.

This flow will Writer to prepare for new data set before actual data will arrive, for example open new file, prepare new printf template, prepare new SQL statement, etc.

Convert Cartographer into inheritance.

Instead of having separate "factory" actor:

use UpRooted::Cartographer::MySQL;

my $connection = DBIish.connect( 'mysql', host => ..., port => ..., ... );
my $schema = UpRooted::Cartographer::MySQL.new( :$connection ).schema( );

Just extend base Schema:

use Schema::MySQL;

my $connection = DBIish.connect( 'mysql', host => ..., port => ..., ... );
my $schema = Schema::MySQL.new( :$connection );

Add CI tests for `Schema::MySQL`.

Decide which database use. Percona is probably most popular today on server environments but MariaDB diverged more from vanilla MySQL. Or maybe use all of them?

Implement `Writer::PostgreSQLFile`.

If lucky this will reuse almost whole logic from Writer::MySQLFile except quoting.
Probably Writer::Helper::SQLQuery could be created to be shared by both.
Which will also reuse later VALUES batching code.

Implement `Reader` base class.

It should accept Tree as contract and iterate over Paths in their order.
Each Path should be processed by specific Reader implementation and produce set or rows.

Reader should expose channel, which will receive Table, row, row, row, Table, row, row, row, row, row... pattern.
Channel should be closed when last Path is processed.
Each set of new root Table conditions should open new Channel.

Implement `Tree`.

Tree can be represented as set of Paths from root Table to every leaf Table (intermediate Tables are also considered leafs). This is also contract for Reader.

It must have circuit breaker when Path detected loop.

Move all DBI-ish and SQL-ish stuff to common Roles.

Avoid copy-pasting code between MySQL and PostgreSQL implementations wherever possible. For example:

  • Information Schema is read using the same logic and in the same order (only queries are different for each engine)
  • Reader is exactly the same.
  • Writer to another database handle is exactly the same.
  • Writer to SQL file can use common Fully Qualified Names caching.

If successful we will get PostgreSQL implementations almost for free, only tests will be needed.

Implement `Writer::MySQLFile`.

To complete proof-of-concept chain from Schema to Writer MySQL seems like simplest choice.

Dumping to *.sql file or cloning to another database are probably two most common dev tasks.

Use params consistently across whole public interface.

my $writer = UpRooted::Writer::MySQLFile.new( :!use-schema-name );
$writer.write( $reader, id => 1 );

This looks bad for example, named param, positional param and slurpy param in one class.
Not to mention future write method options may have conflicts with conditions if more params are added.

Should be named params all the way:

my $writer = UpRooted::Writer::MySQLFile.new( :!use-schema-name );
$writer.write( :$reader, conditions => { 'id' => 1 } );

Restore `UpRooted::Column.type` and change it to database type.

This was noble idea to provide "safe" common type that UpRooted::Writer can rely on.

However this is faulty because of following reasons:

  • Database type mappings are full of edge cases. MySQL does not have boolean types, Postgres does. MySQL does not have array types, Postgres does. PostgreSQL has two Raku drivers with slightly different type mappings. Some other databases may have weird types. Tracking and trying to establish simple common types for UpRooted::Column is very difficult.
  • It will lead to unnecessary double casting in UpRooted::Readers in many cases.
  • Some UpRooted::Writers may benefit from complex types. Like for example Writer::JSON (if implemented) will handle PostgreSQL array types without any issues. It is best for Writer to decide how to handle data from database driver.
  • We should not limit user. For example if user decides to write custom Converter for DBDish (let's say for spatial data) and custom UpRooted::Writer that can store this type he should be able to do so without looking at real column type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.