Ejemplo n.º 1
0
    def test_many_to_many_through_self_aliased(self):
        """Make sure aliased recursive through tables work."""
        through_field = Person._meta.get_field("parents")
        through = through_field.remote_field.through

        metadata = MetaData(schema="unique")
        sa_models = construct_models(metadata)
        aliased(sa_models[through])
Ejemplo n.º 2
0
    def test_many_to_many_through_self(self):
        """Make sure recursive through tables work."""
        through_field = Person._meta.get_field("parents")
        through = through_field.remote_field.through

        metadata = MetaData(schema="unique")
        sa_models = construct_models(metadata)
        self.assertEqual(sa_models[through].table.schema, "unique")
Ejemplo n.º 3
0
 def test_custom_metadata_schema_aliased(self):
     """Make sure the aliased command works with the schema."""
     # This was an issue that cropped up after things seemed
     # to be generating properly, so we want to test it and
     # make sure that it stays working.
     metadata = MetaData(schema="pseudorandom")
     sa_models = construct_models(metadata)
     aliased(sa_models[Log])
Ejemplo n.º 4
0
 def test_custom_metadata_schema(self):
     """Use a custom MetaData instance to add a schema."""
     # The use-case for this functionality is to allow using
     # Foreign Data Wrappers, each with a full set of Django
     # tables, to copy between databases using SQLAlchemy
     # and the automatically generation of aldjemy.
     metadata = MetaData(schema="arbitrary")
     sa_models = construct_models(metadata)
     self.assertEqual(sa_models[Log].table.schema, "arbitrary")
Ejemplo n.º 5
0
    def test_many_to_many_through_self_aliased(self):
        """Make sure aliased recursive through tables work."""
        from sample.models import Person
        through_field = Person._meta.get_field('parents')
        if django.VERSION < (1, 9):
            through = through_field.rel.through
        else:
            through = through_field.remote_field.through

        metadata = MetaData(schema='unique')
        sa_models = construct_models(metadata)
        aliased(sa_models[through])
Ejemplo n.º 6
0
    def test_many_to_many_through_self(self):
        """Make sure recursive through tables work."""
        from sample.models import Person

        through_field = Person._meta.get_field("parents")
        if django.VERSION < (1, 9):
            through = through_field.rel.through
        else:
            through = through_field.remote_field.through

        metadata = MetaData(schema="unique")
        sa_models = construct_models(metadata)
        self.assertEqual(sa_models[through].table.schema, "unique")