sqlalchemy.dialects.mysql.DATETIME - python examples

Here are the examples of the python api sqlalchemy.dialects.mysql.DATETIME taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

26 Examples 7

3 View Complete Implementation : 4ca75174f417_update_dv_sample_status.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("biobank_dv_order", "created", existing_type=mysql.DATETIME(), nullable=True)
    op.alter_column(
        "biobank_dv_order",
        "modified",
        existing_type=mysql.DATETIME(fsp=6),
        nullable=True,
        existing_server_default=sa.text("current_timestamp(6) ON UPDATE current_timestamp(6)"),
    )
    op.create_index(op.f("ix_biobank_stored_sample_test"), "biobank_stored_sample", ["test"], unique=False)
    op.execute(
        "ALTER TABLE biobank_dv_order CHANGE COLUMN `created` `created` DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) AFTER id;"
    )

3 View Complete Implementation : 4ca75174f417_update_dv_sample_status.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_biobank_stored_sample_test"), table_name="biobank_stored_sample")
    op.alter_column(
        "biobank_dv_order",
        "modified",
        existing_type=mysql.DATETIME(fsp=6),
        nullable=False,
        existing_server_default=sa.text("current_timestamp(6) ON UPDATE current_timestamp(6)"),
    )
    op.alter_column("biobank_dv_order", "created", existing_type=mysql.DATETIME(), nullable=False)

3 View Complete Implementation : 534d805d5dcf_alter_biobank_dv_table.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("biobank_dv_order", sa.Column("version", sa.Integer(), nullable=False))
    op.alter_column(
        "biobank_dv_order",
        "modified",
        existing_type=mysql.DATETIME(fsp=6),
        nullable=False,
        existing_server_default=sa.text("CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)"),
    )
    op.create_unique_constraint(None, "biobank_dv_order", ["biobank_order_id"])
    op.drop_column("biobank_dv_order", "biobank_reference")

3 View Complete Implementation : d5cbabd682e5_pmi_code_lookup_functions.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("participant", "last_modified", existing_type=mysql.DATETIME(fsp=6), nullable=False)
    # ### end Alembic commands ###

    op.create_fn(fn_get_code_module)
    op.create_fn(fn_get_code_module_id)

3 View Complete Implementation : d5cbabd682e5_pmi_code_lookup_functions.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("participant", "last_modified", existing_type=mysql.DATETIME(fsp=6), nullable=True)
    # ### end Alembic commands ###

    op.drop_fn(fn_get_code_module)
    op.drop_fn(fn_get_code_module_id)

3 View Complete Implementation : dc971fc16861_fix_dv_order_created.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "biobank_dv_order",
        "created",
        existing_type=mysql.DATETIME(fsp=6),
        nullable=True,
        existing_server_default=sa.text("current_timestamp(6)"),
    )

3 View Complete Implementation : dc971fc16861_fix_dv_order_created.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : all-of-us
def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "biobank_dv_order",
        "created",
        existing_type=mysql.DATETIME(fsp=6),
        nullable=False,
        existing_server_default=sa.text("current_timestamp(6)"),
    )

3 View Complete Implementation : sqlutil.py
Copyright GNU General Public License v3.0
Author : ChrisCummins
  @staticmethod
  def MillisecondDatetime():
    """Return a datetime type with millisecond precision.

    Returns:
      A column type.
    """
    return sql.DateTime().with_variant(mysql.DATETIME(fsp=3), 'mysql')

3 View Complete Implementation : sqlutil.py
Copyright GNU General Public License v3.0
Author : ChrisCummins
  @staticmethod
  def MillisecondDatetime(nullable: bool = False,
                          default=labdate.GetUtcMillisecondsNow):
    """Return a datetime column with millisecond precision.

    Returns:
      A column which defaults to UTC now.
    """
    return sql.Column(sql.DateTime().with_variant(mysql.DATETIME(fsp=3),
                                                  'mysql'),
                      nullable=nullable,
                      default=default)

3 View Complete Implementation : 95a62f05f603_create_schedules.py
Copyright Apache License 2.0
Author : google
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('schedules',
    sa.Column('created_at', mysql.DATETIME(), nullable=False),
    sa.Column('updated_at', mysql.DATETIME(), nullable=False),
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('cron', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('pipeline_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['pipeline_id'], [u'pipelines.id'], name=u'schedules_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )